For those of you that work on a lot of different repo’s and in different branches in those repos, I’m sure you see this a lot when trying to publish a new branch.
Like most of you I just copy/paste what it tells me to, but it does give us a hint to how to fix this issue by telling us to look in git help config so we can set push.autoSetupRemote
to true.
The only problem with this is it wont set your upstream. So if you are a single developer working in your own repository, that’s fine, but once you start to get away from the origin you need to add --set-upstream
.
Here’s the CLI commands to fix that:
git config --global --add push.default current && git config --global --add push.autoSetupRemote true
Now after git push
you should see this: