Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 5: Pushing and pulling from new GitHub repository does not work

Tags:

git

github

xcode5

On GitHub, I have deleted my existing repository and created a new one with the same name Test.

Now, when trying to push my local repository to GitHub for the first time, I get the error message: "Working copy out of date. Try pulling from the remote to get the latest changes, then push again."

And when trying to pull from GitHub, I get the error message: "Test is not a valid remote branch to pull from. Please choose a different remote branch."

I have only one branch, which is master.

How can I solve this issue with Xcode 5?

like image 826
AlexR Avatar asked Oct 31 '13 11:10

AlexR


People also ask

Why git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

Why is GitHub rejecting my push?

A commit gets rejected and causes a failed to push some refs to error because the remote branch contains code that you do not have locally. What this means is that your local git repository is not compatible with the remote origin. Based on the above, your local machine is missing commits C and D.

Why can't I push code to GitHub?

To push a branch on remote, your branch needs to have the latest changes present in remote repository. If you get the failed to push error, first do git pull the branch to get the latest commits and then push it.

How do I push code from GitHub to Xcode?

Push your projectGo to Source Control in Xcode and select Projectname -- master, then Configure... In the Address field, paste the Git clone URL for your repo copied in the previous step. Select Add Remote, then select Done to finish creating the origin remote for your local Git repo.


1 Answers

This is how I got this to work:

  1. Deleted repository on GitHub.
  2. Created a new repository with the same name, but did not include the .gitIgnore and ReadMe file recommended by GitHub.
  3. Pushed the local repository using Xcode 5.

It works perfectly now!

Again: Do not include the .gitIgnore and ReadMe file from GitHub.

P.S. If someone else answers this question, I will selected his answer as the correct answer.

like image 110
AlexR Avatar answered Sep 30 '22 15:09

AlexR