为什么git不拉?

为什么git不拉?

问题描述:

我创建了一个本地分支,像这样为什么git不拉?

$ git branch group_contact_form 

我犯了一些变化,然后发送分支到远程,像这样:

$ git push origin group_contact_form 

我可以很高兴地继续推动提交和$ git branch -a显示我的本地和远程分支

* group_contact_form 
    master 
    remotes/origin/HEAD -> origin/master 
    ... 
    remotes/origin/group_contact_form 
    ... 

但是,当我尝试用$ git pull拉:

fatal: 'origin/group_contact_form' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly 

.git/config如下:

[core] 
    repositoryformatversion = 0 
    filemode = true 
    bare = false 
    logallrefupdates = true 
    ignorecase = true 
[remote "origin"] 
    fetch = +refs/heads/*:refs/remotes/origin/* 
    url = database1:/var/git/repo_name.git 
[branch "master"] 
    remote = origin 
    merge = refs/heads/master 
[branch "group_contact_form"] 
    remote = origin/group_contact_form 
    merge = refs/heads/master 

我做了什么错?

在部分branch "group_contact_form"merge设置似乎是错误的。我觉得应该是

merge = refs/heads/group_contact_form 

此外,remote

remote = origin 

这是我执行git push origin mybranch后收到的设置。

+0

修复了这个问题。谢谢 – 2011-05-06 14:50:29

+1

如果有人想知道如何找到这些设置:'.git/config' – evnu 2011-05-06 14:50:38

尝试以下操作:

git branch --set-upstream group_contact_form origin/group_contact_form 

您应该执行:

git remote show origin 

这会给你一个列表,它的本地分支tracking branches

如果您当地的分行没有跟踪远程,您可以创建跟踪分支:

git checkout -b origin/group_contact_form 

然后,只需变基您当地的分行,所以你可以更新变化

+1

+1'git remote show origin'非常有用。之前没有遇到过。 – 2011-05-06 14:51:07

+0

链接已死亡 – Marc 2017-10-11 12:55:33