git-annex/doc/tips/cloning_a_repository_privately.mdwn
Joey Hess 141a4e9750
consistent name for config
annex.private is a bit ambiguous about what kind of privacy, but
it keeps the name symmetric with remote.foo.annex-private.
2021-04-23 14:39:57 -04:00

62 lines
2.5 KiB
Markdown

Normally, when you clone a git-annex repository, and use git-annex in it,
and then push or otherwise send changes back to origin, information gets
committed to the git-annex branch about your clone. Things like the annexed
files that are in it, its description, etc.
If you don't want the world to know about your clone, either for privacy
reason or only because the clone is a temporary copy of the repository,
here's how.
Recently git-annex got a new config setting, `annex.private`.
Set it before you start using git-annex in a repository, and git-annex
will avoid recording any information about the repository into the
git-annex branch.
git clone ssh://... myclone
cd myclone
git config annex.private true
git annex init
Now you can use git-annex as usual, adding files to the repository,
getting the contents of files, etc.
When you push changes back to origin, do still push the git-annex branch,
since git-annex still uses it to record anything it needs to keep track of
that does not involve your private repository.
And be sure, when adding or editing annexed files, that you `git-annex copy`
them to a publically accessible repository. Otherwise, to everyone else,
there will seem to be no copies of that file availble anywhere, since they
won't know about your private repo's copy.
## private special remotes
You can also make private special remotes, by using `git annex initremote
--private`.
Like a private repository, git-annex avoids storing any information about
a private special remote to the git-annex branch. It will only be available in
the repository where the special remote was created.
Bear in mind that, if you lose the repository where the private special
remote was created, you'll lose the information git-annex needs to access
that special remote, and that will likely mean you'll not be able to
recover any files stored in it.
## private git remotes
When the git config "remote.name.private" is set, git-annex will avoid
recording anything in the git-annex branch about the remote. This is
set by `git-annex initremote --private`, and could also be set for
git remotes. This could be useful, perhaps. Update this tip if you have a
good way to use it.
## where the data is actually stored
The private data gets stored in .git/annex/journal-private/ rather
than in the git-annex branch.
It's possible to move those files to .git/annex/journal/ (being careful
to not overwrite files already in there), and it will then get committed to
the git-annex branch. Do this only if you decide you don't want a private
repository after all.