2014-10-30 169 views
3

我无法让Git在远程获取新的分支。 git remote show不会显示除主人以外的任何分支存在,但git ls-remote证明他们存在。Git fetch没有下载远程分支

例子:git ls-remote表明分支homodyne_process exist-

$ git ls-remote origin 
b935ee960a588144d3df0f08a82b81ea705c7543  HEAD 
f11bd3ac9c2345a12edb9d49cd5bd027616b2226  refs/heads/homodyne_process 
b935ee960a588144d3df0f08a82b81ea705c7543  refs/heads/master 

中获取更新,并显示远程分支机构

$ git fetch 
$ git remote show origin 
* remote origin 
    Fetch URL: [email protected]:*** 
    Push URL: [email protected]:*** 
    HEAD branch: master 
    Remote branch: 
    master tracked 
    Local branches configured for 'git pull': 
    master  merges with remote master 
    Local refs configured for 'git push': 
    homodyne_process pushes to homodyne_process (fast-forwardable) 
    master   pushes to master   (up to date) 
$ git branch -r 
    origin/master 

我管理运行

git pull origin homodyne_process:homodyne_process 

后得到homodyne_process pushes (...)线但它仍然不会显示远程分支母鹿s存在。为什么会发生?

我也尝试过任何git fetch origin homodyne_process和很多组合,但分支origin/homodyne_process将不会出现。

我在windows上工作,回购是通过gitolite托管的。

(我已删除从输出一些其他分支,为简洁起见。)

回答

5

这个回答解决了我的问题,我https://stackoverflow.com/a/25941875/1982894

基本上我需要运行

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" 

这设置GIT中提取所有远程设有分公司,而不仅仅是主。原配置是:

$ git config --get remote.origin.fetch 
+refs/heads/master:refs/remotes/origin/master 
+0

如果你不介意我问,配置怎么变成'+ refs/heads/master:refs/remotes/origin/master'? – nishantjr 2017-05-10 16:31:28

+0

好问题。不幸的是,我不知道。我不记得做任何会影响配置的事情。 – Mixopteryx 2017-05-10 18:29:18

+1

令人讨厌的问题,使我花了一个下午无尽的,神秘的错误,如“合并:起源/主 - 我们不能合并”和“合并:起源/主 - 我们不能合并”。该解决方案修复了它!我包括后人的错误字符串,所以下一个git受害者...呃...用户可能会找到连接,并感谢你和我的那个 – 2018-01-24 18:36:48