Git列出不存在的遥控器 [英] Git listing non-existent remotes
问题描述
[远程原产地]
url = blah等等
[遥远的未来]
url = blah blah
我去了并改变它们,所以它们看起来像这样:
#原来的原产地
[远程的原产地]
#以前的未来回购
但是现在,当我输入 git branch - > [code code code $ g
$>一个
,我看到从旧的'未来'远程列出的分支: remotes / origin / HEAD
遥控器/原产地/分支1
遥控器/原产地/分支2
遥控器/未来/分支1
遥控器/未来/分支2
遥控器/原产地/ $ b remotes / old-origin / branch3
我运行了修剪以及抓取等。但那个列表不会被更新,我搜索了我的未来的配置文件,没有任何东西出现。是否有任何命令可以运行来刷新此列表并停止查看不存在的远程? 您曾经有过远程命名为 future
,而现在你不会。
因此, git remote 任何 future
都无能为力,因为没有名为 future
的远程。 (通常是 git remote update -p
或 git remote prune
,就像上面的注释一样,可以让你摆脱)
最简单的选项似乎是手动删除它们:
git update-ref -d refs / remotes / future / branch1
git update-ref -d refs / remotes / future / branch2
(或 rm -r .git / refs / remotes / future
和/或编辑)。 git / packed-refs
,这取决于这些ref是否已经被打包了。)
[顺便说一句,我还会运行 git config -e
(或者 vi .git / config
这就是我通常的做法:-))并且确保没有其他对 future 远程的剩余引用。]
I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin.
For example, I had this previously:
[remote "origin"]
url = blah blah
[remote "future"]
url = blah blah
I went in and changed them so they look like this:
# formerly the origin
[remote "old-origin"]
# formerly the future repo
[remote "origin']
But now, when I type git branch -a
, I am seeing branches listed from the old 'future' remote:
remotes/origin/HEAD
remotes/origin/branch1
remotes/origin/branch2
remotes/future/branch1
remotes/future/branch2
remotes/old-origin/master
remotes/old-origin/branch3
I ran a prune as well as a fetch, etc. but that list just won't be updated. I did a search on my config file for 'future' and nothing turns up. Are there any commands I can run to refresh this list and stop looking at that nonexistent remote?
解决方案 You used to have a remote named future
, and you don't now.
Hence, git remote whatever future
can't help, because there is no remote named future
. (Normally git remote update -p
or git remote prune
, as in the comments above, would let you get rid of these.)
The simplest option would seem to be to delete them manually:
git update-ref -d refs/remotes/future/branch1
git update-ref -d refs/remotes/future/branch2
(or rm -r .git/refs/remotes/future
and/or edit .git/packed-refs
, depending on whether these refs have gotten packed).
[Incidentally, I'd also run git config -e
(or vi .git/config
which is what I usually really do :-) ) and make sure there are no other left-over references to the future
remote.]
这篇关于Git列出不存在的遥控器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!