How can I set the default target for a push in Visual Studio Code? I currently have two targets configured (github and azure) and want to set the "Push" action from the menu to one of the two.
I'd try to set the default remote in your project's configuration. Perhaps, VSC uses it to know where to push?
You can do it as follow:
git config remote.pushDefault nameOfYourRemote
And from man git-config
:
remote.pushDefault The remote to push to by default. Overrides branch.<name>.remote for all branches, and is overridden by branch.<name>.pushRemote for specific branches.
And the section about branch.<name>.remote
(that remote.pushDefault
overrides):
branch.<name>.remote When on branch <name>, it tells git fetch and git push which remote to fetch from/push to. The remote to push to may be overridden with remote.pushDefault (for all branches). The remote to push to, for the current branch, may be further overridden by branch.<name>.pushRemote. If no remote is configured, or if you are not on any branch, it defaults to origin for fetching and remote.pushDefault for pushing. Additionally, . (a period) is the current local repository (a dot-repository), see branch.<name>.merge's final note below.
Which allows you to have origin
still, but also other remotes and one of them being the default one instead of origin
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With