On github, I've forked a project from its original source original/project-name
so now I have a remote repo on github myusername/project-name
. I would now like to switch my github repo to use a contributors fork contributor/project-name
. How can I do this?
As already noted in the comments, it's as simple as
git remote set-url origin https://github.com/contributor/project-name.git
An alternative you may want to consider is to create a second remote for the fork.
git remote add fork https://github.com/contributor/project-name.git
If you want to keep the fork up-to-date with the original repo, you can refer to my answer to this question .
Gabriele's answer provides the quickest and most concise option, but you could alternatively edit the .git/config file to change the remote. Possibly a better choice would be to add another remote all together as done by
git remote add REMOTE_NAME_HERE REMOTE_URL_HERE
ie:
git remote add test https://github.com/username/test-project.git
where "test" becomes the name of your new remote. You would then push to the remote repo using "test" instead of "origin"
git push -u test BRANCH_NAME
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.