无法推入/拉入/拉出连接到 Xcode 的全新存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14452245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't push/pull to/from brand new repository hooked up to Xcode
提问by Trevor McKendrick
I'm really new at this, so thanks for your patience (and dealing with my frustration).
我在这方面真的很陌生,所以感谢您的耐心(以及处理我的挫败感)。
I've created a new Xcode project, put it under source control, and have successfully made changes/commits locally.
我创建了一个新的 Xcode 项目,将其置于源代码管理之下,并在本地成功进行了更改/提交。
I've created a public repository at Github (https://github.com/nyuman/Beaner, and excuse the title it's an old inside joke. I'm making a bean counter).
我在 Github ( https://github.com/nyuman/Beaner )创建了一个公共存储库,请原谅它的标题是一个古老的内部笑话。我正在制作一个豆计数器。
And I've also successfully added that repository in Xcode. I used git as the username, my SSH link, etc.
而且我还成功地在 Xcode 中添加了该存储库。我使用 git 作为用户名、我的 SSH 链接等。
The problem: when I push from Xcode I get a popup telling me "Working copy out of date. Trying pulling from the remote to get the latest changes, then push again."
问题:当我从 Xcode 推送时,我收到一个弹出窗口,告诉我“工作副本已过期。尝试从远程获取最新更改,然后再次推送。”
So I then try and pull, upon which I get this popup: "Beaner/master" is not a valid remote branch to pull from. Please choose a different remote branch."
所以我然后尝试拉,我得到这个弹出窗口:“Beaner/master”不是一个有效的远程分支。请选择不同的远程分支。”
I've followed this guide 100%: http://www.raywenderlich.com/13771/how-to-use-git-source-control-with-xcode-in-ios-6
我已 100% 遵循本指南:http: //www.raywenderlich.com/13771/how-to-use-git-source-control-with-xcode-in-ios-6
I don't have any outstanding changes that need to be committed. Xcode tells me the remote repository is hooked up fine (green lights everywhere). This has happened practically every time and try and setup source control through Xcode and it's driving me crazy...
我没有任何需要提交的突出更改。Xcode 告诉我远程存储库连接良好(到处都是绿灯)。这几乎每次都发生,并尝试通过 Xcode 设置源代码控制,这让我发疯......
采纳答案by cjc343
Were you successful or is the commit on github not from your xcode project?
你成功了还是 github 上的提交不是来自你的 xcode 项目?
Assuming you've already gone through the xcode steps of creating a new project and making some commits which you are now ready to push to github:
假设您已经完成了创建新项目并进行了一些提交的 xcode 步骤,您现在可以将其推送到 github:
- Create a new repo on github, say
nyuman/Beaner2
. Don't change anything else on github. Don't add a README. - Copy the ssh URL (assuming you just created the new repo):
[email protected]:nyuman/Beaner2.git
Open a Terminal window and navigate to your project directory. In that window run:
git remote add origin [email protected]:nyuman/Beaner2.git git push origin master:master
- 在 github 上创建一个新的 repo,比如
nyuman/Beaner2
。不要更改 github 上的任何其他内容。不要添加自述文件。 - 复制 ssh URL(假设您刚刚创建了新的存储库):
[email protected]:nyuman/Beaner2.git
打开终端窗口并导航到您的项目目录。在那个窗口中运行:
git remote add origin [email protected]:nyuman/Beaner2.git git push origin master:master
Unless there are additional local branches you wish to push, your repos should now be in sync.
除非您希望推送其他本地分支,否则您的存储库现在应该是同步的。
回答by Spidey
My workaround was to install GitHub for Mac. Installed, entered my credentials for GitHub, selected the repo, pulled then pushed and all is well...Doesn't explain what is wrong with XCode 5.1...
我的解决方法是为 Mac 安装 GitHub。安装,输入我的 GitHub 凭据,选择 repo,拉然后推,一切都很好......没有解释 XCode 5.1 有什么问题......