Skip to content

Instantly share code, notes, and snippets.

@mohokh67
Last active December 10, 2020 11:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohokh67/66ce2cf64ba5e5fedb362f4f7a18d4bc to your computer and use it in GitHub Desktop.
Save mohokh67/66ce2cf64ba5e5fedb362f4f7a18d4bc to your computer and use it in GitHub Desktop.
Git push the current branch and set the remote as upstream

If you see the bellow error for the first time when you try to push your new branch which has not been pushed:

git push                 

fatal: The current branch new-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-branch

then fix it by running this command:

git config --global push.default current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment