我刚做了 git init 来将我的文件夹初始化为git repo,然后使用 git remote add origin url 添加了一个远程存储库 . 现在我想删除这个 git remote add origin 并添加一个新的存储库 git remote add origin new-url . 我该怎么做?
git init
git remote add origin url
git remote add origin
git remote add origin new-url
如果你坚持删除它:
git remote remove origin
或者,如果你有Git版本1.7.10或更早
git remote rm origin
但kahowell's answer更好 .
要删除遥控器:
要添加远程:
git remote add origin yourRemoteUrl
最后
git push -u origin master
你可以尝试这个,如果你想删除原点然后添加它:
然后:
git remote add origin http://your_url_here
我没有足够的声誉评论@ user1615903的答案,所以添加这个作为答案:“git remote remove”不存在,应该使用“rm”而不是“remove” . 所以正确的方法是:
您可以使用以下命令重命名(更改远程存储库的URL):
git remote set-url origin new_URL
new_URL可以像https://github.com/abcdefgh/abcd.git
永久删除远程存储库使用:
另一种方法
取消本地git存储库
rm -rf .git
然后;再次创建git repostory
然后;重复远程repo连接
git remote add origin REPO_URL
您可以转到 .git 文件夹,在不使用命令的情况下编辑配置文件 .
请使用以下命令删除远程仓库:
“origin”:遥控器的名称
您可以执行以下操作,而不是删除和重新添加:
git remote set-url origin git://new.url.here
看到这个问题:Change the URI (URL) for a remote Git repository
9 回答
如果你坚持删除它:
或者,如果你有Git版本1.7.10或更早
但kahowell's answer更好 .
要删除遥控器:
要添加远程:
最后
你可以尝试这个,如果你想删除原点然后添加它:
然后:
我没有足够的声誉评论@ user1615903的答案,所以添加这个作为答案:“git remote remove”不存在,应该使用“rm”而不是“remove” . 所以正确的方法是:
您可以使用以下命令重命名(更改远程存储库的URL):
new_URL可以像https://github.com/abcdefgh/abcd.git
永久删除远程存储库使用:
另一种方法
取消本地git存储库
然后;再次创建git repostory
然后;重复远程repo连接
您可以转到 .git 文件夹,在不使用命令的情况下编辑配置文件 .
请使用以下命令删除远程仓库:
“origin”:遥控器的名称
您可以执行以下操作,而不是删除和重新添加:
看到这个问题:Change the URI (URL) for a remote Git repository