Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub error "Failed to get HEAD"

Tags:

github

macos

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?
like image 204
Failed Software Developer Avatar asked Dec 01 '14 15:12

Failed Software Developer


3 Answers

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.

like image 100
calabiyauman Avatar answered Nov 10 '22 01:11

calabiyauman


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:

  1. Created a new repository on GitHub.com
  2. Cloned the empty repository using GitHub Desktop
  3. Created a new project locally on my computer inside the directory I cloned the repository to in step 2.
  4. 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.

like image 2
Dave Patrick Avatar answered Nov 10 '22 03:11

Dave Patrick


This error can appear if you did not initiate the repository. make sure to check the box saying "Initialize this repository with a README"

like image 1
Gulli Avatar answered Nov 10 '22 01:11

Gulli