I have two remotes origin and fork. What I want to achieve is to make git pull
pull from origin and make git push
push to fork.
- One approach is set different URLs for pull and push in
.git/config
.url
is for pull.pushurl
is for push. https://stackoverflow.com/a/7420741/431698 mentions this method. - The other is to use
git remote set-url
to seturl
andgit remote set-url --push
to setpushurl
. This approach basically does the same thing as method 1. https://stackoverflow.com/a/15903520/431698 mentions this method. - Use
remote.pushdefault
. https://stackoverflow.com/a/18562564/431698 mentions this method.
Is there any method to achieve my goal?