Search code examples
gitshared-hostinggit-push

Why is my git push to HostGator shared hosting failing?


I'm attempting to deploy my local repo to a remote directory. I've run git init --bare in this remote directory, and added the correct ssh path to my local git repo branch (named dev) with git remote add server ssh://user@domain.com:2222/path/to/repo.

When I run git push server dev I get the following output:

Counting objects: 44, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (37/37), done.
Writing objects: 100% (44/44), 89.58 KiB, done.
Total 44 (delta 2), reused 27 (delta 2)
error: Could not read 551dd5c5d67e3b2da4074d8f15a59a324a063a03
fatal: Failed to traverse parents of commit 0615b940c3247e3547de1379ab09a4a6bb614252
error: Could not read 551dd5c5d67e3b2da4074d8f15a59a324a063a03
fatal: Failed to traverse parents of commit 0615b940c3247e3547de1379ab09a4a6bb614252
To ssh://user@domain.com:2222/path/to/repo
 ! [remote rejected] dev -> master (missing necessary objects)
error: failed to push some refs to 'ssh://user@domain.com:2222/path/to/repo'

I'm not sure what is going on here.


Solution

  • As mentioned in "git repository failed to traverse parent error", this can also be caused by a shallow clone.

    In your case though (testing repo), restarting from scratch is the easiest.

    In general, you have interesting advices in this thread:

    1. Use "git rev-list --objects" to find out what 40aaeb204dc was.

    And if that doesn't work:

    2. Run "git fsck --full", with packs intact. This will take a while.
    The result would include a list of missing objects (like 40aaeb204dc), and, most importantly, their type.

    Following howto/recover-corrupted-blob-object.txt would be useful for identifying a corrupt loose object.