I just did git init
to initialize my folder as git repo 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?
我只是用git init初始化了我的文件夹,然后用git远程添加源url添加了一个远程存储库。现在,我想删除这个git远程添加源,并添加一个新的仓库git远程添加源新url。我怎么做呢?
7 个解决方案
#1
1040
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
请参见这个问题:更改远程Git存储库的URI (URL)
#2
467
If you insist on deleting it:
如果您坚持要删除:
git remote remove origin
Or if you have Git version 1.7.10 or older
或者如果您有Git版本1.7.10或更老的版本
git remote rm origin
But kahowell's answer is better.
但卡豪威尔的回答更好。
#3
41
To remove a remote:git remote remove origin
要删除远程:git远程删除源文件
To add a remote:git remote add origin yourRemoteUrl
& then git push -u origin master
要添加远程:git remote添加origin yourRemoteUrl,然后git push -u origin master
#4
26
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:
我对@user1615903的回复没有足够的评价,所以添加如下答案:“git远程删除”不存在,应该使用“rm”而不是“删除”。正确的方法是
git remote rm origin
#5
17
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
#6
4
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
您可以使用以下方法重命名(更改远程存储库的URL): git远程设置URL来源new_URL new_URL可以类似https://github.com/abcdefgh/abcd.git
Too permanently delete the remote repository use :
git remote remove origin
太永久地删除远程存储库使用:git远程删除原点。
#7
-2
please use the following command in order to remove the remote repo :
请使用以下命令删除远程回购:
git remote rm origin
git远程rm起源
"origin" : the name of the remote
“起源”:遥控器的名字
#1
1040
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
请参见这个问题:更改远程Git存储库的URI (URL)
#2
467
If you insist on deleting it:
如果您坚持要删除:
git remote remove origin
Or if you have Git version 1.7.10 or older
或者如果您有Git版本1.7.10或更老的版本
git remote rm origin
But kahowell's answer is better.
但卡豪威尔的回答更好。
#3
41
To remove a remote:git remote remove origin
要删除远程:git远程删除源文件
To add a remote:git remote add origin yourRemoteUrl
& then git push -u origin master
要添加远程:git remote添加origin yourRemoteUrl,然后git push -u origin master
#4
26
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:
我对@user1615903的回复没有足够的评价,所以添加如下答案:“git远程删除”不存在,应该使用“rm”而不是“删除”。正确的方法是
git remote rm origin
#5
17
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
#6
4
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
您可以使用以下方法重命名(更改远程存储库的URL): git远程设置URL来源new_URL new_URL可以类似https://github.com/abcdefgh/abcd.git
Too permanently delete the remote repository use :
git remote remove origin
太永久地删除远程存储库使用:git远程删除原点。
#7
-2
please use the following command in order to remove the remote repo :
请使用以下命令删除远程回购:
git remote rm origin
git远程rm起源
"origin" : the name of the remote
“起源”:遥控器的名字