无法更改我的远程回购

时间:2012-12-24 22:04:58

标签: xcode git command-line github repository

我对git有点新鲜,结果我陷入了混乱。我有一个Xcode 4.5项目。在命令行中,我一直在管理它的本地git repo以及github上与本地gitub链接的远程仓库。一切顺利,直到我决定删除GitHub网站上的远程仓库(名为PictureFly)并在GitHub网站上创建一个新的远程仓库(称为PhotoFly)。我希望我的本地仓库取消链接到旧的远程仓库(PictureFly)并链接到新的远程仓库(PhotoFly)。看似简单,但无论我输入什么命令,我都会收到一个致命的警告或另一个。这是我一直在做的典型例子:

我尝试删除旧的远程源:

//first attempt
git push origin :https://github.com/jac300/PictureFly.git
//first error
fatal: remote part of refspec is not a valid name in      
:https://github.com/jac300/PictureFly.git

//second attempt
git push origin :PictureFly.git
//second set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

//third attempt    
git push origin --delete PictureFly
//third set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

//fourth attempt
git push origin --delete https://github.com/jac300/PictureFly.git
//fourth set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

然后我想也许我可以添加新的远程仓库:

git remote add origin https://github.com/jac300/PhotoFly.git
fatal: remote origin already exists.  //how does it already exist?

因为它“已经存在”,我试图推动那个回购:

git push -u origin master
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.

我不知道发生了什么或如何解决它。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:2)

您可以轻松删除GitHub上的回购并从网站创建一个新的回购。所以现在你被困在你的遥控器指向错误的网址。修复:

git remote set-url origin https://new.url.here