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?
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.
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.
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.
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.
This is how I got this to work:
.gitIgnore
and ReadMe
file recommended by
GitHub. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With