Ben Griffiths
Ben Griffiths

Reputation: 1105

Why is git not pulling?

I created a local branch like so

$ git branch group_contact_form

I committed some changes then sent the branch to remote like so:

$ git push origin group_contact_form

I can quite happily keep pushing commits and $ git branch -a displays my local and remote branch

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

But, when I try to pull with $ git pull:

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

My .git/config is as follows:

[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

What have I done wrong?

Upvotes: 9

Views: 12701

Answers (3)

evnu
evnu

Reputation: 6680

Your merge setting in the section branch "group_contact_form" seems to be wrong. I think it should be

merge = refs/heads/group_contact_form

Additionally, remote should be

remote = origin

That's the setting I receive after executing git push origin mybranch.

Upvotes: 3

Pablo Fernandez
Pablo Fernandez

Reputation: 105210

You should execute:

git remote show origin

This will give you a list of which local branches are tracking branches

If your local branch is not tracking the remote, you can create a tracking branch with:

git checkout -b origin/group_contact_form

Then just rebase your local branch so you can update the changes

Upvotes: 7

ralphtheninja
ralphtheninja

Reputation: 132988

Try the following:

git branch --set-upstream group_contact_form origin/group_contact_form

Upvotes: 1

Related Questions