Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: fatal: The current branch master has multiple upstream branches, refusing to push

Tags:

git

I have this strange issue, whenever I do git push it refuses to do anything:

fatal: The current branch master has multiple upstream branches, refusing to push.

When I do git push -u origin master it seem to set it as a tracking branch:

Branch master set up to track remote branch master from origin.

But the next time I try git push it refuses to do this again. I tried to google but it seems the problem is fairly new and I couldn't find any explanation for this behaviour. Ideas?

Update: ./git/config

[remote "origin"]     fetch = +refs/heads/*:refs/remotes/origin/*     url = [email protected]:milk.git [branch "master"]     remote = origin     merge = refs/heads/master 

Update2: Solved with git config remote.origin.push HEAD the following line appeared in .git/config to [remote "origin"] section:

    push = HEAD 

Update3:

$ git branch -vv   billing      633c796 [origin/billing: behind 889] links * master       1a0de50 [origin/master: ahead 1] more fixes   new_master   3b880d7 [origin/new_master] branches diverged   photo_stacks 29c8f0d [origin/photo_stacks] 1st try   responsive   1dad980 [origin/responsive] update  $ git push fatal: The current branch master has multiple upstream branches, refusing to push. 
like image 779
firedev Avatar asked Oct 23 '12 12:10

firedev


2 Answers

You might want to do the following:

git config remote.origin.push HEAD 

Pushing without any arguments on a master branch can lead to your error message. I'm not sure if it's a regression problem, or if it's always been the case.

like image 101
Peter van der Does Avatar answered Sep 21 '22 18:09

Peter van der Does


Run git config -l and look to see if you have multiple lines containing branch.master* references The [branch "master"] section may be duplicated ~/.gitconfig and .git/config. Deleting the one in ~/.gitconfig fixed the mutiple upstream branch detection for me.

like image 40
mmullis Avatar answered Sep 20 '22 18:09

mmullis