I'm new to Git. Let's say Alice and Bob had been developing their project by using two Git repositories for each. And, Alice at certain times want to set up a new repository to manage their common progress. Do you think what is the best way to replace remote.origin.url in the configuration of Git?
Ist Step:- Change the current working directory to your local project. 2nd Step:- List your existing remotes in order to get the name of the remote you want to change. Change your remote's URL from HTTPS to SSH with the git remote set-url command. 4th Step:- Now Verify that the remote URL has changed.
If they already have a remote called origin
but want the new remote to be called origin
then the most logical thing to do is rename or remove the existing remote called origin
and add a new one:
git remote rename origin old_origin
git remote add origin url://new/url.git
If you don't care about the old origin you can just reset the URL, but you would probably want to do a full git fetch
and a git remote prune origin
afterwards for tidiness.
git config remote.origin.url url://new/url.git
If you have a very recent git (>1.7.0), you have a remote sub command for this:
git remote set-url origin url://new/url.git
Well simply update the url in config file from .git directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With