How to remove remote origin from Git repo

时光毁灭记忆、已成空白 提交于 2019-11-26 21:12:13
kahowell

Instead of removing and re-adding, you can do this:

git remote set-url origin git://new.url.here

See this question: Change the URI (URL) for a remote Git repository

1615903

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.

Vontei

To remove a remote:

git remote remove origin

To add a remote:

git remote add origin yourRemoteUrl

and finally

git push -u origin master

you can try this out,if you want to remove origin and then add it:

git remote remove origin

then:

git remote add origin http://your_url_here

I don't have enough reputation to comment answer of @user1615903, so add this as answer: "git remote remove" does not exist, should use "rm" instead of "remove". So the correct way is:

git remote rm origin
Anshul Bisht

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

Another method

Cancel local git repository

rm -rf .git

Then; Create git repostory again

git init

Then; Repeat the remote repo connect

git remote add origin REPO_URL

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
Shusen Yi

You can go to the .git folder, edit the config file without using the commands.

first will change push remote url

git remote set-url --push origin https://newurl

second will change fetch remote url

git remote set-url origin https://newurl
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!