无法从Xcode连接到全新的存储库 [英] Can't push/pull to/from brand new repository hooked up to Xcode

查看:124
本文介绍了无法从Xcode连接到全新的存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很新,所以感谢您的耐心(并处理我的沮丧)。



我创建了一个新的Xcode项目,在源代码控制下,并已成功地在本地进行更改/提交。



我在Github上创建了一个公共存储库( https://github.com/nyuman/Beaner ,原谅这是一个古老的笑话,我正在制作一个bean计数器)。

我也成功地在Xcode中添加了该存储库。我使用git作为用户名,我的SSH链接等。



问题:当我从Xcode推入时,弹出窗口告诉我工作副本已过期。



然后我试着拉出来,然后我弹出这个弹出窗口:Beaner / master是没有一个有效的远程分支来拉。请选择另一个远程分支。



我按照这个指南100%: http://www.raywenderlich.com/13771/how-to-use-git-source-control -with-xcode-in-ios-6



我没有任何未完成的更改需要提交.Xcode告诉我远程存储库是(每个地方都有绿灯),这几乎每次都会发生,并尝试通过Xcode设置源代码控制,这让我发疯......

解决方案<



假设您已经完成了创建新的xcode步骤,那么您是否成功或者是github上的提交而不是您的xcode项目?项目并进行一些提交,你现在已经准备推送给github:


  1. 在github上创建一个新的仓库,比如 nyuman / Beaner2 。不要改变gith上的其他任何东西不要添加自述文件。
  2. 复制ssh URL(假设您刚刚创建了新的回购站): git@github.com:nyuman / Beaner2.git

  3. 打开一个终端窗口并导航到您的项目目录。在该窗口中运行:

      git remote add origin git@github.com:nyuman / Beaner2.git 
    git push原产主:master


您希望推送的分行,您的回购券现在应该同步。


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.

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).

And I've also successfully added that repository in Xcode. I used git as the username, my SSH link, etc.

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."

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."

I've followed this guide 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...

解决方案

Were you successful or is the commit on github not from your xcode project?

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:

  1. Create a new repo on github, say nyuman/Beaner2. Don't change anything else on github. Don't add a README.
  2. Copy the ssh URL (assuming you just created the new repo): git@github.com:nyuman/Beaner2.git
  3. Open a Terminal window and navigate to your project directory. In that window run:

    git remote add origin git@github.com: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.

这篇关于无法从Xcode连接到全新的存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆