Search code examples
gitgithubgit-remote

Fatal error in remote git push


I'm trying to push a local project to an empty GitHub repository (created only minutes ago), but I'm getting some errors.

I created my GitHub repository following the instructions here, and made my initial local git commit:

git add .
git commit -m "Initial commit" (this was successful)
git remote add origin https://github.com/[name]/[repo].git
git remote -v

Everything worked fine through that point, but next I tried this:

git push -u origin master

And got back the following stdout:

Counting objects: 8, done.
Delta compression using up to 8 threads.
error: garbage at end of loose object 'b3872d786a175232c101cca4bbd8f2cddde5622d'
fatal: loose object b3872d786a175232c101cca4bbd8f2cddde5622d (stored in .git/objects/b3/872d786a175232c101cca4bbd8f2cddde5622d) is corrupt
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
fatal: write error: Bad file descriptor
error: failed to push some refs to 'https://github.com/[name]/[repo].git'

This is the first time I've tried to push a local project to GitHub, and I can't seem to find a solution to my problem on GitHub's site or StackOverflow. Anybody know what to do here? Running OS X.


Solution

  • SOLUTION: Fairly simple fix for me - I just had to go up to the parent directory and rm -rf .git from there, too. Seems like a bit of a hack-y way to resolve it, and I'm still not quite sure what I did to cause the issue in the first place...

    If anyone else runs into the same problem please be sure to pass it along here!