Local Repository Out of Date - Make sure all changes have been pulled from the remote repository and try again - xcode

I am new to Git. I would like to set it up on xcode so I can develop across my devices. I can commit just fine within Xcode through the "Source Control" menu, but when I push to the repository what I get is: Local Repository Out of Date - Make sure all changes have been pulled from the remote repository and try again.
I then try to pull from the repository and I get: An unknown error has occurred: no merge base found (-3)
What is going on?
I pushed my source code to GitHub, and then I pulled. I expected each to work but I get the errors I mentioned.

Related

Can't push to TFS Git repository from Eclipse, but command line works fine

I have a Git repository provided by my organization's local instance of TFS. I can checkout, pull, switch branches, etc, all from within Eclipse using the built in capabilities, but when I try to push commits, it times out after 5 minutes with the error:
Can't connect to any repository: ssh://<my redacted project URL> (ssh://<my redacted project URL>: Short read of block.)
It works fine from the Git Bash command line, and as mentioned all other commands seem to work fine from Eclipse.
There is a similar issue reported here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=531807
Based on the comments looks like jgit received some corrupt data during push.
Just try David's solution :
Copying out changed files, deleting project and repo, recloning repo,
creating project, copying back in changed files, pushing. Success.
Basically try to clone a new local repo, tested on my side and it works as expected.

GitHub error "Failed to get HEAD"

I'm new to GitHub and mainly going to be using it to backup service and to show off code. Anyhow, I'm trying to get my latest program up there and am getting the error in the title of this thread when I try to push.
Repro steps:
Sit in Starbucks with crappy wifi (Could this be related to the problem? Serious question.)
Open latest version of GitHub for latest Macintosh operating system
File --> New Repository
Local Path --> the folder that contains my XCode project
Name --> give it a name
Publish
Sync
Push .... Get error
Look in my XCode project's folder and it looks like an empty subfolder with the name of my GitHub project was created there. Huh?
I had these issues, I followed these steps to resolve.
cd /directory
git init
git add .
git commit -m "Name of Repo"
I then opened the github desktop application and dragged the folder over.
All my files are now available and I can make commits. Hope this helps.
I received a similar error using GitHub Desktop on OS X. I got the error when trying to commit files for the first time to a newly created repository. The error message was something along the following: Failed To Get Head (Unborn)
The steps I followed to create the error were:
Created a new repository on GitHub.com
Cloned the empty repository using GitHub Desktop
Created a new project locally on my computer inside the directory I cloned the repository to in step 2.
Using GitHub Desktop, tried to commit the files. This is when I got the error.
To "fix" this, I went to GitHub desktop and created a ReadMe for the repository. I then 'Synced' the repository on GitHub Desktop and was able to commit.
This error can appear if you did not initiate the repository. make sure to check the box saying "Initialize this repository with a README"
In my case all I needed to do was to run:
git add -A
After this I was successfully able to commit through the GitHub client.
I was using Xcode and I copied some files into the folder with my project and they were not automatically added to the git (hence the error).
git reset
And then come back to GitHub Desktop. That works in my case.
Certainly not the Starbucks Wifi.
This happened to me with the official GitHub client when I tried to make an initial commit, I then tried again using the inbuilt versioning module within my code editor (Intellij IDEA) and it worked just fine.
I won't even hazard a guess to the cause of the problem, but try a different GIT client if you need a potential quick fix.
Please try to commit first and try to push. I am also very new to git, I used to SVN a lot, It worked for me after initial commit.

Xcode crashes when working with repository

I have an Xcode project one local and one remote repository. Firstly, there was a problem in current version and I decided to change local repository's head using terminal. Xcode fetched everything and I continued working on the project. When I decided to commit changes, Xcode gave me an error like this: "error: src refspec (detached from ) does not match any.error: failed to push some refs to [repository address]". After, I decided to create a new remote repository and try to make initial commit of this project. I added remote to Xcode and now it crashes even if I open "remotes" tab. I use bitbucket as my remote repo.
Question: is it possible to fix this, or it is easier to copy all the contents of the project to another one and commit new one? Thanks for replies.
I had the same problem: the local git repo was created from command line (from terminal app) and not from within Xcode, Xcode would crash every time even when clicking on the remote tab. I have a different solution that may be easier:
1)Commit and Push all changes with your current project from your local Xcode-non-compatible repo
2) Re-open Xcode (close it if it's open) and select "Check out an existing project" from Xcode
*If you don't see this Xcode startup screen, go to Source Control->Check Out...
3)Select the remote repo then
4)Select a NEW directory for the checkout destination
Now you will have a project set up and compatible with Xcode!
Solved:
Create new empty project, then copy all the files from previous one. Create new repository, absolutely clean. Push there.
It seems that Xcode had a conflict when local repository's head was changed using command line and git. So, this is as warning for users who got the same situation.

xcode, error when commiting to github repository

I am developing an iphone project on xcode and I'd like to commit my code to a git repository on github. When I select the "commit" option within xcode I got the following error message:
The working copy "iphone" could not be reached.
Please verify that the working copy is reachable and try again.
I checked in the repository option and deleted the repository I had set up at the beginning. My code is under git and I have added the remote origin but still... it does not work from xcode (I have to commit and push from command line which is working fine).
Any idea ?
Make sure this isn't about some locked resource which prevents XCode to access your local repo.
For instance, in "Can't add xCode 4.2 project to repository (and get it working)", a reboot actually helped...

Xcode thinks a remote svn repos is git

I'm running Xcode 4.1 at work and home. I've successfully checked out a project from a remote svn repository (work) on my home setup. The repos was updated, so when I got home, I did an update on the local checkout.
The status of the updated files got flagged "U" (good) and a page appeared showing changes to accept, but when I hit accept, I get a popup that says:
The working copy "ABRA-D" failed to pull. fatal: Not a git repository
(or any of the parent directories): .git
Well, yes... the repo is svn, not git! Closing Xcode and restarting removes the "U" tags and I'm back where I started. Sounds like Xcode is confused about the repo type, though it knew enough to query the svn repo and find out what had been updated. Anyone know a cure?
That issue, already mentioned in "Error : Fatal: Not a git repository (or any of the parent directories): .git", has a somewhat curious solution described here:
Recently I created a new project and at some point I uploaded it to SVN. I am not quite sure how to reproduce this situation but somehow the versioning support of Xcode 4 decided to interpret the project as a git repository.
Each time I tried to copy a file per drag and drop into my project I got following error:
fatal: Not a git repository (or any of the parent directories): .git
The result was that the file got copied into the project folder, but the reference didn't get set in the project. I had to go into the folder and drag and drop the file again and uncheck the copy option this time, so that the reference gets set.
The Solution
Open Xcode and go to Window > Organizer
Find under repositories your project. It might be two entries if you use something like SVN.
Make sure it says "Type Git"
Mark the repository entry and hit backspace or delete (on mac)
Done
In my case, when i created my project it was using git. But later i removed all git files from my SVN repository. Then took an update.
Now, when i tried to add files, it gives me same error.
Solution: I removed all repositories against my project in XCode Organizer. Now when i added new files, it works fine.
I had a git and svn against the same project and tried removing the git and got this error
In the end went and manually edited xcshareddata found at and removed all the entries which had anything to do with the git repositoy.
myproject.xcodeproj/project.xcworkspace/xcshareddata

Resources