I just did git init
to initialize my folder as Git repository and then added a remote repository using git remote add origin URL
. Now I want to remove this git remote add origin
and add a new repository git remote add origin new-URL
. How can I do it?
1056
votes
11 Answers
1977
votes
Instead of removing and re-adding, you can do this:
git remote set-url origin git://new.url.here
See this question: How to change the URI (URL) for a remote Git repository?
To remove remote use this:
git remote remove origin
743
votes
If you insist on deleting it:
git remote remove origin
Or if you have Git version 1.7.10 or older
git remote rm origin
But kahowell's answer is better.
94
votes
43
votes
36
votes
19
votes
You can rename (changing URL of a remote repository) using :
git remote set-url origin new_URL
new_URL can be like https://github.com/abcdefgh/abcd.git
Too permanently delete the remote repository use :
git remote remove origin
14
votes
To set a origins remote url-
git remote set-url origin git://new.url.here
here origin is your push url name. You may have multiple origin. If you have multiple origin replace origin as that name.
For deleting Origin
git remote rm origin/originName
or
git remote remove origin/originName
For adding new origin
git remote add origin/originName git://new.url.here / RemoteUrl
10
votes
4
votes