forum/Sharing annex with local clonesgit-annexhttp://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/git-annexikiwiki2020-06-17T01:18:32Zdon't do thathttp://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_1_2b60e13e5f7b8cee56cf2ddc6c47f64d/joey2013-11-27T22:47:37Z2012-03-19T18:23:13Z
<p>Suppose you do that to repos A and B. Now, in A, you <code>git annex drop</code> a file that is only present in those repositories. A checks B to make sure it still has a copy of the file. It sees the (same) file there, so assumes it's safe to drop. The file is removed from A, also removing it from B, and losing data.</p>
<p>It is possible to configure A and B to mutually distrust one-another and avoid this problem, but there will be other problems too.</p>
<p>Instead, git-annex supports using <code>cp --reflink=auto</code>, which on filesystems supporting Copy On Write (eg, btrfs), avoids duplicating contents when A and B are on the same filesystem.</p>
comment 2http://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_2_24ff2c1eb643077daa37c01644cebcd2/Bryon2013-11-27T22:47:37Z2012-03-19T18:46:13Z
Ah, OK. Is there a configuration step to set this up, or is this included magic in a new enough git-annex client?
comment 3http://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_3_5359b8eada24d27be83214ac0ae62f23/Bryon2013-11-27T22:47:37Z2012-03-19T18:55:03Z
Nevermind, found it. (git-annex 0.08)
comment 4http://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_4_5c870c49d8093e1a2895224cc6e91ca0/Nicolas2014-11-04T23:05:46Z2014-11-04T23:05:46Z
On file system not supporting reflink is there another solution for sharing annex with local clones ?
comment 5http://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_5_0bf4c0aa3258b156a3df794d5fabb6a2/joey2014-11-06T20:03:54Z2014-11-06T19:50:54Z
<p>Yes, there's another option since git-annex version 5.20140915.</p>
<p>annex.hardlink can be set to true, and then <code>git annex get</code> will
simply hardlink the files into place.</p>
<p>Note the caution about using this option:</p>
<pre><code> Use with caution -- This can invalidate numcopies counting,
since with hard links, fewer copies of a file can exist. So, it
is a good idea to mark a repository using this setting as
untrusted.
</code></pre>
<p>And, there's a nice easy way to set up local clone that is configured this way:</p>
<pre><code> When a repository is set up using git clone --shared, git-annex
init will automatically set annex.hardlink and mark the reposiā
tory as untrusted.
</code></pre>
Thanks, this does exactly what I wanthttp://git-annex.branchable.com/forum/Sharing_annex_with_local_clones/comment_6_d2ebe3cc20ec8b7c778c7b22aa62896c/calmofthestorm2020-06-17T01:18:32Z2020-06-15T07:25:30Z
I'm always impressed that when I Google for how to do some very specific thing with git-annex, there's typically already an easy to use option that does exactly that. The default behavior when a git repo is cloned with --shared is excellent user experience, and precisely matches my intuition for how it should behave.