DEV Community

loading...

How to Fix Git fatal: The current branch has no upstream branch

Vance Lucas
Lead Developer for Web, Mobile, API & Severless, Community Builder. Co-founder of Techlahoma Foundation, ThunderPlains, and OKC.js User Group.
Originally published at vancelucas.com on ・1 min read

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

fatal: The current branch <branchname> has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin <branchname>
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Now you can git push without anymore errors!

Discussion (1)

Collapse
alexwambui profile image
Alex Wambui

am still getting an error:
error: failed to push some refs to 'github.com/.....'
any ideas...???