Normally a git repository is not treated as a special remote, but as a git remote of the normal kind. Two exceptions to that are git-lfs and gcrypt special remotes.
But it is possible to register a git repository as a special remote. git-annex and git will use the remote the same as any normal git remote, but its url will be recorded in the repository. One benefit of doing this is it allows git-annex init to autoenable the remote.
First you need a regular git remote with the url that you want to use for the special remote.
git remote add tmpremote ssh://...
Then, to set up the special remote:
git annex initremote myremote type=git location=ssh://... autoenable=true
The location must be the same url as the existing git remote.
Now git annex init
in each clone of the repository will autoenable myremote.
Note that the name of the git remote (tmpremote
above) has to be
different than the name you later use for the special remote,
since git-annex initremote will refuse to use the name of an existing
remote. To work around that, you could finish by removing tmpremote
and
enable the special remote:
git remote remove tmpremote
git annex enableremote myremote
This only works for git repositories that have a git-annex uuid set, because git-annex thinks about special remotes in terms of their uuid. So it cannot be used with a git remote hosted somewhere that does not have git-annex installed.
This can only be used for git remotes that have an annex-uuid set. All special remotes have to have a uuid. git remotes that are hosted on a system with git-annex installed get the annex-uuid set up automatically, but it won't happen if your special remote is on github or something like that. You could
git config remote.foo.annex-uuid $(uuid)
to generate and set a new uuid, I suppose.git-annex: Unknown remote name.
. I assume this is because git annex does not create a uuid for the type=git special remote, presumably because non is set for the actual git remote (the annex-uuid key does not exist for the existing git remote with the same url). This is the relevant line generated in remote.log:autoenable=true location=<ssh-url> name=<name> type=git timestamp=1629118438.628919s
, as you can see there is no uuid at the beginning. Any ideas if this is a bug or if the instructions are outdated?