skip to Main Content

I have empty private repository on GitHub I can normally access from the web.

When I make attempt to push some history I already did locally, I’m getting:

fatal: protocol error: unexpected capabilities^{}

Googling indicates in the past it meant server doesn’t support SHA256, but that was 9 years ago. What could go wrong today?

How to diagnose the problem?

What’s the remedy for it?

I’m using git version 2.34.1 from Ubuntu 22.04.


Edit: Following @VonC answer I upgraded git to 2.42.0. And now the message changed to:

fatal: the receiving end does not support this repository's hash algorithm

which absolutely doesn’t help how to fix the problem with the local repo. Hashes in the log are 64 characters long.

2

Answers


  1. Chosen as BEST ANSWER

    The problems seems to be that the error (in new git):

    fatal: the receiving end does not support this repository's hash algorithm
    

    is caused by the simple fact GitHub in 2023 still doesn't support repository version format 1 with SHA256 commits (Sadly true about GitLab either).

    When I rewrite history by format-patch of each commit and git am them on fresh repository with format version 0 (I had to recreate tags as well), then I managed to push.

    Now, how my repository has been created as version 1 originally I don't know/remeber - I think it was bare git init, but maybe it was something else (possibilities are cargo and VSCode).

    You have been warned. Hopefully this answer (valid at the day of writing) would help anyone else Googling for this problem.


  2. I have seen that error message when using Eclipse/JGit, as I explained in JGit: BundleWriter Error when including Refs.

    This patch explains:

    The cause is that, since v3.1.0.201309270735-rc1~22 (Advertise capabilities
    with no refs in upload service., 2013-08-08), JGit’s ref advertisement includes
    a ref named capabilities^{} to advertise its capabilities on, while git’s ref
    advertisement is empty in this case. This allows the client to learn about the
    server’s capabilities and is needed, for example, for fetch-by-sha1 to work
    when no refs are advertised.

    This also affects "ls-remote". For example, against an empty repository served by JGit:

    $ git ls-remote git://localhost/tmp/empty
    0000000000000000000000000000000000000000        capabilities^{}
    

    Git advertises the same capabilities^{} ref in its ref advertisement for push, but since it never did so for fetch, the client didn’t need to handle this case.

    Check first if the push was done from Eclipse (which would not use a system Git)
    And check if upgrading Git (command-line) is enough.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search