Fix for the current branch has no upstream branch error message

This is one of those git config things you set once and forget years later when you setup a new machine. How did we get here? You can git push expecting to fly up to the remote repository right?

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

    git push --set-upstream origin feature-1234

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

To get rid of this message forever and prevent git from gatekeeping you just run this:

git config --global push.default current

This will set your git config to only push your current branch when running git push. Enjoy never having to worry about this again!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Made in NYC ✌️