dwyl / dev-setup

✈️ A quick-start guide for new engineers on how to set up their Dev environment
81 stars 21 forks source link

How to Setup remote branch automatically 🤖 (`push.autoSetupRemote`) #52

Open nelsonic opened 2 years ago

nelsonic commented 2 years ago

Each time I setup a branch on my localhost and attempt to push it to GitHub, I get an error message similar to the following:

n@MBP auth % git push

fatal: The current branch gen-erd-#207 has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin gen-erd-#207

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

Need to look this up and get it configured so that it automatically creates the remote branch for me. 💭

Todo

nelsonic commented 2 years ago
git config --global --add push.default current
git config --global --add push.autoSetupRemote true

Via: https://pawelgrzybek.com/auto-setup-remote-branch-and-never-again-see-an-error-about-the-missing-upstream/ Thanks @pawelgrzybek ❤️

pawelgrzybek commented 2 years ago

I am glad it helped you out @nelsonic !