fatal: The current branch master has no upstream branch

后端 未结 23 2221
误落风尘
误落风尘 2020-11-30 16:46

I\'m trying to push one of my projects to github, and I keep getting this error:

peeplesoft@jane3:~/846156 (master) $ git push

fatal: The current branch mas         


        
23条回答
  •  [愿得一人]
    2020-11-30 17:01

    If you constantly get the following git error message after attempting a git push with a new local branch:

    fatal: The current branch has no upstream branch.

    To push the current branch and set the remote as upstream, use

    git push --set-upstream origin 
    

    Then the issue is that you have not configured git to always create new branches on the remote from local ones.

    The permanent fix if you always want to just create that new branch on the remote to mirror and track your local branch is:

    git config --global push.default current
    

    Now you can git push without any errors!

    https://vancelucas.com/blog/how-to-fix-git-fatal-the-current-branch-has-no-upstream-branch/

提交回复
热议问题