Skip to content

arcnmx/git-annex-remote-b2

 
 

Repository files navigation

git-annex-remote-b2

This is a fork of the abandoned encryptio/git-annex-remote-b2 that contains various improvements and bugfixes.

Installation

Binaries are available not yet available in the releases page. You want to add the binary to your $PATH, either by creating a new directory for it (ideally inside your home directory, such as ~/bin), or by putting the binary in a directory that is already in your $PATH (such as /usr/local/bin.)

To build from source, set up a GOPATH and then run go get github.com/arcnmx/git-annex-remote-b2.

Usage

After putting git-annex-remote-b2 in your $PATH, use it like any other external remote:

~/repo $ git annex initremote b2 type=external externaltype=b2 bucket=mydata

B2 credentials must be provided as the environment variables $B2_APP_KEY, $B2_ACCOUNT_ID, and optionally $B2_KEY_ID during initremote. If gpg encryption is enabled or embedcreds=yes is used, the credentials will be stored in the git-annex repository and thus will be available to all clones of it.

Optionally, you may pass prefix=something/ to have git-annex-remote-b2 prepend something/ to the keys it stores in B2.

Limitations

Large files

By default, B2 only supports files up to 5GiB. To work around this limitation you can use git-annex's chunk support by passing chunk=100MiB when you do the initremote, or any time after by doing git-annex enableremote b2 chunk=100MiB.

Improving the financial cost of this remote

By default, all remotes are semitrusted in git-annex. This means that the remote should be checked to see if it actually has data when doing an operation that assumes that the data is safe if they have it and unsafe if not (for example, a local git annex drop.) If you tell git-annex that this remote won't lose data randomly by setting this remote's trust level higher, then those checkpresentkey calls (which turn into ListFileNames calls on B2) should go away.

This is particularly important if you're under the free trial limits of B2.

~/repo $ git annex trust b2

Secondly, git-annex will assume all non-local remotes have the same cost, and won't prefer one over the other by default. If you have a remote that doesn't cost as much as talking to B2, you should set the B2 remote's cost very high so that git-annex will prefer talking to the cheap remote rather than B2 when possible. (The default values are 100 for local remotes, and 200 for non-local remotes.)

~/repo $ git config remote.b2.annex-cost 1000

Note that setting the annex-cost like this is a repo-local operation only; it does not apply to other clones of the repo you might have.

About

git-annex special remote for Backblaze's B2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 76.7%
  • Nix 14.2%
  • Shell 9.1%