The other night I wanted to upload some photo's to my git-annex remote on our home NAS (a Synology DS416, let's call it mallorca), but reality decided otherwise:

$ git annex copy --to mallorca path/to/nice-picture-01.jpg
fatal: Run with no arguments or with -c cmd
git-annex-shell: git-shell failed
(unable to check mallorca) failed

Cue a lengthy debugging session digging through git-over-SSH, several layers of login-shells and other redirection stumbling blocks.

I finally ended up on this bug report (by the way: not thanks to googling, which delivered very poorly, but from grepping through the git-annex source code) which points to this changelog note:

git-annex (8.20211028) upstream; urgency=medium

  This version of git-annex removes support for communicating with git-annex
  remotes that have version 6.20180312 or older installed.

Yep, that sound like my problem (local and remote version drifted too far apart):

  • locally, on my laptop, I run version 10.20220624 (recently updated with Homebrew)
  • the Synology NAS is stuck at version 6.20161212 (later releases don't run anymore)

Because I have no idea yet how to upgrade git-annex on the NAS-side I'm currently forced to downgrade laptop-side. Shouldn't be that big of an issue if you're using a package manager like Homebrew, right? Right? Turns out that Homebrew does not support easy installing of an older version of a package, e.g. by adding some kind of version constraint, as found in other package managers. There are ways to achieve installing old Homebrew formulas, but it's not trivial, barely/poorly documented while the wrong (and now defunct) way still ranks a lot higher in search results.

Anyway, as explained in this Homebrew discussion, you have to create a new "tap" of your own, "extract" the desired version of the Homebrew formula to it and install it from there. I tried that to install git-annex version 8.20211011, and in honor of Saint Murphy, the compilation failed:

==> cabal v2-install --jobs=4 --max-backjumps=100000 --install-method=copy --installdir=/usr/local/Cellar/git-annex@8.20210903/8.20210903/bin --flags=+S3
Last 15 lines from /Users/stefaan/Library/Logs/Homebrew/git-annex@8.20210903/02.cabal:

Remote/GitLFS.hs:461:46: error:
    • Couldn't match expected type ‘LFS.ServerSupportsChunks
                                    -> RequestBody’
                  with actual type ‘RequestBody’
    • In the first argument of ‘send’, namely ‘body’
      In the second argument of ‘($)’, namely ‘send body sha256 size’
      In a stmt of a 'do' block:
        forM_ (LFS.objects resp) $ send body sha256 size
    |
461 |                                         send body sha256 size
    |                                              ^^^^
cabal: Failed to build git-annex-8.20210903. See the build log above for
details.

Cue another session trying to figure out compilation problems with a language (Haskell) and build system (Cabal) I don't know. By luck, I found out there is a compile flag GitLfs I could turn off to work around that compilation problem and have a complete build.

Finally, after way too many hours deep down in the alien, hostile caverns of other people's code and systems, I have a working build of an old enough git-annex version. Hashtag party hat.

For posterity, I preserved my Homebrew tap for this git-annex version at github.com/soxofaan/homebrew-git-annex: git-annex@8.20211011 which can be installed with:

brew tap soxofaan/git-annex
brew install git-annex@8.20211011

Because I still had the original, latest git-annex version installed (10.20220624), I got a warning that the original symlinks were not automatically updated. Instead, I had to do the unlinking/relinking manually with

brew unlink git-annex 
brew link --overwrite git-annex@8.20211011

Ok, that's enough for now. Time to be productive again. I hope.