Search code examples
gitgithubfatal-error

Git fatal error: can't pull code to my server


I have a Django webapp running on a WebFaction Linux server. Up until two days ago I could use git as I expected to: changing the files locally, and then pulling the code in the server.

However, today this happened when trying to pull in my server:

remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 50 (delta 38), reused 41 (delta 29), pack-reused 0
Unpacking objects: 100% (50/50), 6.68 KiB | 684.00 KiB/s, done.
fatal: unresolved deltas left after unpacking
fatal: unpack-objects failed

Git status results in:

On branch master
Your branch is up to date with 'origin/master'.

event though I have changes that have been registered by Git (I can see my changes on GitHub, as well as I can also work with git normally in my own PC).

I have seen every possible answer I could find about git fatal errors, and none of them gave me any insights as to what's going on.

Any thoughts?


Solution

  • This error message means that either your repository or the remote repository is broken in some way.

    When Git performs a fetch, it negotiates which objects it already has with the remote server. The remote server then sends a pack that contains deltas (that is, sets of changes) against either other objects in the pack or against objects that you should have on your own system. This latter case, when the pack refers to objects that are outside of it, is called a thin pack; normally packs must be complete and contain deltas against only other objects they contain.

    In this case, your version of Git is trying to resolve those deltas into whole objects and there are some it cannot resolve. That could mean that your repository is missing objects it should have, or it could mean that the remote side is sending corrupt data, possibly because it also lacks objects (or it could just have a bug).

    The thing to do here is to try git fsck on your repository and see if it talks about any missing objects. If it talks about missing objects, you can try to make another clone from the server and copy it over. The Git User Manual describes how to do this in detail, so it should be relatively easy to do.

    If your repository is fine, you could try contacting GitHub Support and asking them to verify the repository. It is unlikely but possible that the replica of that repository you fetched from is somehow broken and hasn't been detected yet, and they could repair the repository.

    If you want to take the lazy approach, you can just clone anew and then run git fsck, and if it passes, you're good to go.