Git: fatal: the current branch wizard has several branches upstream, refusing to push

I have this strange problem, when I do git push , it refuses to do something:

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

When I do git push -u origin master , it seems 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 it again. I tried Google, but it seems the problem is quite new, and I could not find an explanation for this behavior. Ideas?

Update: ./git/config

 [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = gitosis@xxxx.xx:milk.git [branch "master"] remote = origin merge = refs/heads/master 

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

  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. 
+62
git
Oct 23 '12 at 12:45
source share
5 answers

You might want to do the following:

 git config remote.origin.push HEAD 

Clicking without any arguments in the main branch may result in your error message. I am not sure if this is a regression problem, or if that has always been the case.

+104
Oct 23
source share

Run git config -l and see if you have several lines containing links branch.master * The section [leading] [branch] can be duplicated ~/.gitconfig and .git/config. Removing this option in ~/.gitconfig fixed the detection of upstream markup for me.

+32
Aug 23 '13 at 14:01
source share

You must indicate which branch you click to. git push will automatically try to pop all links and tags that track local branches. It is possible that the online branches on the server have advanced. Therefore, you may encounter this situation. You should just use

 git push origin master 

And also, to reconcile the changes, do git pull , which will update your local links using the server.

+10
Oct 23 '12 at 12:52
source share

Well, after handling the new repositories twice, I have an answer.

git remote -v

git remote rm (everything except the source if you added any other remotes)

git remote rm origin

! warning: more than one branch .master.remote <- this is good

git remote incremental source git @ github.com: yourname / yourrepo

pull + push = FIXED

+1
Jan 31 '15 at 18:51
source share

This is most likely because there are 2 or more branch.master.remote in your git config. One from your global git config, and the other from your local git config.

When 2 of them are specified in the git configuration, git loses in order not to assume one or the other, even if the latter has prioritized the former.

The modern repositories you clone should include the configuration locally, but it is likely that branch.master.remote also defined in your global git configuration.

To check if it is installed in your global configuration, use:

 git config --global --list | grep branch.master 

You can delete or comment out the branch section in your global git config, and you will be fine.

 git config --global --remove-section branch.master 

This will completely remove [branch "master"] .

If you want to keep it in your global configuration just in case, you can rename it to another branch that you probably won't use.

 git config --global --rename-section branch.master branch.someothername 

However, you should not get the error of multiple upstream branches when you do git push on the master branch.

git remote show origin also no longer trigger a warning.

0
Dec 13 '18 at 0:38
source share



All Articles