2016-11-03 41 views
0

我错误地为我的git回购添加了错误的远程原点。我从来没有明确地设置我的回购的远程起源。我想这一定是默认设置时,设置远程起源之前,我跑:增加了不正确的Git remote;无法删除它或用另一个远程覆盖它

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

我这样做,这样的情况下,从我叉式改变了原有的(上游)回购的代码,这些更改也会上传并反映在我的分支中。我不能肯定这个命令设置我的远程起源,因为我仍然在使用Git结识的早期阶段,但跑

$ git remote -v 

git的时候跟我说,我的起源是:https://github.com/hackreactor/HRATX24-javascript-koans.git。我尝试删除这个远程并覆盖它,但都没有工作。试图删除它时,我收到错误消息 - 致命的:没有这样的远程,当我尝试覆盖它时,我得到了错误信息 - 致命的:远程原点已经存在。这两条错误消息似乎是相互矛盾的,所以我不知道如何继续。任何人都可以帮助我更好地理解发生了什么,以及如何让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. 

回答

4

git remote rm采用遥控器的名称(在这种情况下origin)作为它的命令。

另外,您也可以只更新远程的URL像这样:

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

谢谢。这工作很好! – bluescion

相关问题