Reputation: 3819
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?
Upvotes: 8
Views: 7231
Reputation: 108091
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.
Upvotes: 8
Reputation: 2672
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
i.e.:
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
Upvotes: 1