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

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.

  • Merging with commit filtering?
  • Jenkins build only for develop branch
  • Git contains between arbitrary commits
  • Git doesn't sync files until committed, even if checked out in a different branch
  • Check if commit is first commit in pre-commit hook
  • gitosis did not generate projects.list automatically, gitweb can't work
  • 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 = gitosis@xxxx.xx: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.
    

  • Connect my project to gitlab with android studio
  • Create Branch from an Older Commit
  • git pull “ fatal: Uh oh. Your system reports no Git commands at all.”
  • sh scripting: using conditionals, git post-update script
  • Gulp-git clone in specific folder location. Cloned to 'undefined' folder
  • Publish Git repo on a web-only provider (no shell)
  • 4 Solutions collect form web for “Git: fatal: The current branch master has multiple upstream branches, refusing to push”

    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.

    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.

    You must specify which branch you are pushing to. git push would automatically attempt to push all the refs and tags that the local branches are tracking. It is possible that branches online at the server have moved forward. Therefore you might be ending up with this situation. You should simply use

    git push origin master
    

    And also to reconcile changes do a git pull That will update your local refs with the one from the server.

    Alright, after dealing with this twice with brand new repos I have an answer.

    git remote -v

    git remote rm (everything other than origin if you’ve added any other remotes)

    git remote rm origin

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

    git remote add origin git@github.com:yourname/yourrepo

    pull + push = FIXED

    Git Baby is a git and github fan, let's start git clone.