git-annex/doc/special_remotes/git.mdwn

36 lines
1.4 KiB
Text
Raw Normal View History

2019-10-04 15:22:46 +00:00
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.
2019-10-04 15:28:01 +00:00
git-annex and git will use the remote the same as any normal git remote,
2020-11-21 04:21:26 +00:00
but its url will be recorded in the repository. One benefit of doing this
2019-10-04 15:28:01 +00:00
is it allows [[git-annex init|git-annex-init]] to autoenable the remote.
2019-10-04 15:22:46 +00:00
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
2019-10-04 15:27:19 +00:00
The location must be the same url as the existing git remote.
2019-10-04 15:22:46 +00:00
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,
2019-10-04 15:24:53 +00:00
since [[git-annex initremote|git-annex-initremote]] will refuse to use the name of an existing
2019-10-04 15:22:46 +00:00
remote. To work around that, you could finish by removing `tmpremote` and
enable the special remote:
git remote remove tmpremote
git annex enableremote myremote
2021-08-24 16:45:13 +00:00
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.