Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't push/pull to/from brand new repository hooked up to Xcode

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

like image 861
Trevor McKendrick Avatar asked Jan 22 '13 05:01

Trevor McKendrick


2 Answers

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): [email protected]:nyuman/Beaner2.git
  3. 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
    

Unless there are additional local branches you wish to push, your repos should now be in sync.

like image 94
cjc343 Avatar answered Sep 18 '22 08:09

cjc343


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

like image 42
Spidey Avatar answered Sep 21 '22 08:09

Spidey