小编blu*_*ion的帖子

添加了不正确的Git遥控器;无法删除它或用另一个遥控器覆盖它

我为git repo错误地添加了错误的远程源。我从未明确设置我的仓库的远程来源。我认为必须在设置远程原点之前运行时默认设置它:

$ git remote add upstream https://github.com/hackreactor/HRATX24-javascript-koans.git
Run Code Online (Sandbox Code Playgroud)

我这样做是为了防止分叉的原始(上游)存储库中的代码发生更改,更改也将上传并反映在我的fork中。我不确定该命令是否设置了远程原点,因为我仍处于熟悉git的早期阶段,但是运行时

$ git remote -v
Run Code Online (Sandbox Code Playgroud)

git告诉我,我的起源是:https : //github.com/hackreactor/HRATX24-javascript-koans.git。我试着删除此遥控器并覆盖它,但是没有用。尝试删除它时,我得到错误消息-致命:没有这样的远程,并且当我尝试覆盖它时,我得到了错误消息-致命:远程源已经存在。这两个错误消息似乎是矛盾的,所以我不确定如何继续。谁能帮助我了解正在发生的事情以及如何让git将遥控器重置为正确的网址?

这是我运行的git命令以及git给他们的输出:

$ git remote -v
origin  https://github.com/hackreactor/HRATX24-javascript-koans.git (fetch)
origin  https://github.com/hackreactor/HRATX24-javascript-koans.git (push)
upstream        https://github.com/hackreactor/HRATX24-javascript-koans.git (fetch)
upstream        https://github.com/hackreactor/HRATX24-javascript-koans.git (push)

$ git remote rm https://github.com/hackreactor/HRATX24-javascript-koans.git
fatal: No such remote: https://github.com/hackreactor/HRATX24-javascript-koans.git

$ git remote add origin  https://github.com/BLuEScioN/HRATX24-javascript-koans.git
fatal: remote origin already exists.
Run Code Online (Sandbox Code Playgroud)

git github git-remote

1
推荐指数
1
解决办法
834
查看次数

标签 统计

git ×1

git-remote ×1

github ×1