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

Added incorrect Git remote; can't remove it or overwrite it with another remote

我错误地为我的 git 存储库添加了错误的远程来源。我从未明确设置我的回购协议的远程来源。我认为它一定是默认设置的,在设置远程原点之前,我 运行:

$ git remote add upstream https://github.com/hackreactor/HRATX24-javascript-koans.git

我这样做是为了万一我从中分叉的原始(上游)repo 中的代码发生变化,这些更改也会上传并反映在我的分叉中。我不能确定这个命令设置了我的远程源,因为我还处于熟悉 git 的早期阶段,但是当 运行

$ git remote -v

git告诉我,我的出身是:https://github.com/hackreactor/HRATX24-javascript-koans.git。我试过删除这个遥控器并覆盖它,但都不起作用。尝试删除它时,我收到错误消息 - fatal: No such remote,当我尝试覆盖它时,我收到错误消息 - fatal: remote origin already exists。这两个错误消息似乎是矛盾的,所以我不确定如何进行。任何人都可以帮助我更好地了解发生了什么,以及如何让 git 将我的遥控器重置为正确的 url?

这是我 运行 的 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.

git remote rm 将遥控器的名称(在本例中为 origin)作为其命令。

或者,您也可以像这样更新遥控器的 URL:

git remote set-url origin https://github.com/BLuEScioN/HRATX24-javascript-koans.git