从本地存储库备份到远程服务,例如 Bitbucket
我想使用远程 git 服务上的存储库作为本地创建的存储库的备份。远程服务是 Bitbucket,但这个问题也适用于其他服务。
我无法在 Bitbucket 上创建裸存储库(或者我可以吗?),所以我不知道如何使用“push --mirror”。
推送所有分支和提交是可以的,但我们希望推送尽可能多的内容,例如: 标签、远程指针、远程分支——这样,如果我们克隆回下游,我们就会得到一个与原始本地存储库足够接近的克隆,而不需要太多的重新布线。
我们不关心未提交的工作或工作目录或暂存区域。工作流程是进行提交,然后推送到备份。
我们并不是在寻找覆盖工作和暂存区域的完美克隆。此外,我们并不是在寻求防弹备份,我知道分支可以在本地删除并在远程丢失。所以基本上这是一种简单的方法来对已经存在的服务进行部分备份并提供免费的私人帐户 - 这 提供一定程度的冗余,从而提供一些想法。
我怎样才能达到上述目的。
第一次编辑:
这是第一次试验的日志 - 不是我对全本地测试的预期,而是我得到的结果:
- 在 Bitbucket 上创建存储库:
https://[电子邮件受保护]/shishani /test1.git
- 本地会话
$ git Remote add bbtest1 https://[电子邮件受保护]/shishani/test1.git $ git 状态 # 在分支主控上 无需提交任何内容(工作目录干净) $ git 分支 -a * 掌握 遥控器/原点/HEAD ->起源/主人 遥控器/原点/主控 $ git 远程 -v bbtest1 https://[电子邮件受保护]/shishani/test1.git (拿来) bbtest1 https://[电子邮件受保护]/shishani/test1.git (推) 来源/更多/编码/git-tests/test-orig(获取) 起源 /more/coding/git-tests/test-orig (推送) $ git Push --镜像 bbtest1 密码: 致命:refspec 的远程部分不是 :capability^{} 中的有效名称 fatal:远端意外挂断
知道发生了什么事吗?
第二次编辑:
我在这里针对意外错误消息提出了一个单独的问题: 致命:refspec 的远程部分不是:capability^{} 中的有效名称
I want to use a repo on a remote git service as a backup for a locally created repo. The remote service is namely Bitbucket, but the question can apply to others.
I can't create a bare repo on Bitbucket (or can I?) so I don't know how to work with 'push --mirror'.
Pushing all branches and commits is sort of ok, but we want to push as much more as possible, such as:
tags, remote pointers, remote branches - so that if we clone back downstream, we get a clone that is close enough to the original local repo without the need for too much re-wiring.
We are not concerned about uncommitted work or the working directory or staging area. The workflow is to do a commit then follow by a push to the backup.
We are not seeking a perfect clone that covers working and staging areas. Also we are not seeking a bullet proof backup, I understand that branches can be deleted on local and lost on remote. So basically this is about an easy way to do a partial backup to a service that is already there and providing free private accounts - which
provides some level of redundancy and thus some piece of mind.
How can I achieve the above.
First Edit:
This is a log of first trial - not what I expected from my all-local tests, but this in what I'm getting:
- create repo on Bitbucket:
https://[email protected]/shishani/test1.git
- local session
$ git remote add bbtest1 https://[email protected]/shishani/test1.git $ git status # On branch master nothing to commit (working directory clean) $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master $ git remote -v bbtest1 https://[email protected]/shishani/test1.git (fetch) bbtest1 https://[email protected]/shishani/test1.git (push) origin /more/coding/git-tests/test-orig (fetch) origin /more/coding/git-tests/test-orig (push) $ git push --mirror bbtest1 Password: fatal: remote part of refspec is not a valid name in :capabilities^{} fatal: The remote end hung up unexpectedly
Any idea what's going on ?!
Second Edit:
I forked a separate question for the unexpected error message here:
fatal: remote part of refspec is not a valid name in :capabilities^{}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有使用过 BitBucket,但该过程或多或少与这些托管提供商中的任何一个相同:
创建远程存储库。 (例如:
test
)将其作为远程添加到 git:
推送到它:
I have not used BitBucket, but the process will be more or less equivalent with any of these hosting providers:
Create the remote repository. (eg:
test
)Add it as a remote to git:
Push to it: