alonisser alonisser - 1 year ago 95
Git Question

Changing the default 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.

Answer Source

Another technique I just found for solving this (even if I deleted origin first, what appears to be a mistake) is manipulating git config directly:

git config remote.origin.url url-to-my-other-remote
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download