我最近将我的“主要”远程 git 存储库从 code.google
移到了 github
。然后,我将旧的 origin
存储库重命名为 code-google
并在之前创建了远程 github
到 origin
。到目前为止一切顺利。
但是……
在.git/refs/remotes
中还有引用:
code-google github origin
我试过了,但似乎不起作用:
$ git remote prune github --dry-run
fatal: 'github' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
为什么github改名后还在?为什么我不能处理它?我该如何清理我的存储库?
最佳答案
<德尔> This thread (现已删除)提到重命名 Remote 是不够的:
If you want to be really complete, you should also delete your '
origin
' refs :
rm -R .git/refs/remotes/origin
更安全的方法是克隆您的新远程仓库(现在在 GitHub 上),然后添加另一个远程仓库。
关于git - 为什么 .git/refs/remotes 中的 git remote sill 的旧名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14426231/