Changing the Git remote ‘push to’ default

I want to change the Git default remote branch destination so I could just

git push

Instead of:

git push upstream

Currently this is set to the origin remote and I want to set it to a different remote.

I tried to remove the original (cloned from) remote

git remote rm origin

Which did remove the original remote. But doesn’t solve the git push problem. I still get:

fatal: No configured push destination. Either specify the URL from the
command-line or configure a remote repository using…

I also tried to play with:

git remote set-url --push myfork origin

and other options but none seem to work (maybe because I deleted the origin remote too soon?)

Following the answer here I tried to change:

git config push.default upstream (or matching)

but neither worked.

14 Answers
14

Leave a Comment