Set a push URL for the remote that is different from the pull URL:
git remote set-url --push origin [email protected]:repo.git
This changes the remote.name.pushurl
configuration setting. Then git pull
will pull from the original clone URL but git push
will push to the other.
In old Git versions, git remote set-url
did not have the --push
switch. Without it, you have to do this by changing the configuration setting manually:
git config remote.origin.pushurl [email protected]:repo.git