0

我对 git 有点陌生,结果我让自己陷入了混乱。我有一个 Xcode 4.5 项目。在命令行中,我一直在管理其本地 git 存储库以及本地链接到的 github 上的远程存储库。一切都很好,直到我决定删除 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.

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

4

1 回答 1

2

您可以轻松地删除 GitHub 上的存储库并从网站创建一个新的空存储库。所以现在你被你的遥控器指向了错误的 url。修理:

git remote set-url origin https://new.url.here
于 2012-12-24T22:07:32.013 回答