问题描述
$ git branch -t test当我尝试创建一个跟踪远程分支的新分支时,我得到这个结果: origin / foo
error:Not tracking:ref ref / remotes / origin / foo的模糊信息
似乎以某种方式搜索分支来跟踪和抛出我发现,因为它发现不止一个,但我没有完全得到它所要查找的内容,因为我已经告诉它在命令行上跟踪什么。
有谁可以告诉我发生了什么事以及如何解决它? 明白了!问题是我之前使用 - mirror
设置了一个远程存储器,用于存储我的存储库的备份/公共副本。
如果您运行
git remote add --mirror< name> < URL>
它不仅将遥控器标记为镜像(这是我想要推送的),而且还将镜像配置为 remote。< mirror> .fetch
选项为 + refs / *:refs / *
,其中意味着您的所有分支机构突然跟踪您的镜像存储库,并且任何创建跟踪分支的尝试都将失败。
(作为额外的奖励,运行 git fetch< mirror>
将会覆盖您备份仓库中所有的旧货。)
解决方案这似乎解决这个问题是设置远程。<镜像> .fetch
到:
(我希望,意味着永远不会获取任何东西)。这显然修复了跟踪问题,并消除了致命的获取。
When I try to create a new branch tracking a remote branch, I get this:
$ git branch -t test origin/foo
error: Not tracking: ambiguous information for ref refs/remotes/origin/foo
The source seems to somehow search for branches to track and throws me out because it finds more than one, but I don't exactly get what it's looking for since I already told it what to track on the command line.
Can anybody tell me what's going on and how to fix it?
Got it! The problem was that I have previously set up a remote with --mirror
, for the purpose of having a backup / public copy of my repository.
If you run
git remote add --mirror <name> <url>
it does not only flag the remote as mirror (which is what I wanted for pushes), but also configures remote.<mirror>.fetch
option for the mirror to +refs/*:refs/*
, which means that all of your branches suddenly "track" your mirror repository and any attempt to create a tracking branch is going to fail.
(As an added bonus, running git fetch <mirror>
is going to overwrite all your refs with old ones from your backup repo.)
The solution that seems to fix this issue is setting remote.<mirror>.fetch
to :
(which, I hope, means "never fetch anything"). This apparently fixes the tracking issue and eliminates the deadly fetch.
这篇关于为什么git分支-t失败,出现“Not tracking:ambiguous information”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!