Reputation: 509
I have a repository, say abc/myprject.git
. I have this repo on a server from where I pull my code. Now I have forked this repository, naming it chirag/myproject.git
.
I have two questions, with regards to this:
chirag/myproject.git
repo instead of the original one now, so how do I change it on the server from abc/myproject.git
to the forked one chirag/myproject.git
?abc/myproject.git
, will it cause any issues with chirag/myproject.git
?Thanks
Upvotes: 3
Views: 3854
Reputation: 42933
Use git remote set-url
to change the URL of the origin
remote (if you didn't change anything, the remote repository will be named origin
).
git remote set-url origin git://someserver/chirag/myproject.git
If there's no "physical" relationship between the both repositories at abc/myproject.git
and chirag/myproject.git
you won't run into any problems when deleting the first one. Git is a distributed version control system that produces full, independent repositories upon cloning.
With "physical" relationship" I mean something like softlinks when both repositories reside on the same filesystem or something similar.
Upvotes: 6
Reputation: 468
git config -l
will display the remote origin (ie where the server will try and pull from)
You can remove the current remote with
git remote rm origin
and then add your new repo instead...
git remote add origin [email protected]:chirag/myproject.git
There shouldnt be a problem with then deleteing your original repo and just using the chirag one, although would suggest testing the new setup works before doing that.
You could also add the chirag repo as a second remote to the server, just call it something else eg
git remote add chirag [email protected]:chirag/myproject.git
And then just pull from it rather than origin
git pull chirag master
ps. throughout the example code I've assumed that on the server, the name of the remote to pull form is origin - change the name if its called something else
HTH Doug
Upvotes: 1