I have several remotes which are not always accessible. For example they can be on hosts only accessible by LAN or on a portable hard drive which is not plugged in. When running sync these remotes are checked as well, leading to unnecessary error messages and possibly git-annex waiting for a few minutes on each remote for a timeout.

In this situation it would be useful to mark some remotes as offline (git annex offline <remotename>), so that git-annex would not even attempt to contact them. Then, I could configure my system to automatically, for example, mark a portable hard disk remote online when plugging it in, and offline when unplugging it, and similarly marking remotes offline and online depending on whether I have an internet connection or a connection to a specific network.

You can already do this:

git config remote.foo.annex-ignore true

There's no need to do anything for portable drives that are sometimes mounted and sometimes not -- git-annex will automatically avoid using repositories in directories that do not currently exist.

I thought git-annex also had a way to run a command and use its exit status to control whether a repo was ignored or not, but it seems I never actually implemented that. It might be worth adding, although the command would necessarily run whenever git-annex is transferring data around.

Comment by http://joeyh.name/ Fri Jul 6 13:04:07 2012

Ah, I didn't read the man page carefully enough. My apologies.

Setting the ignore status based on an exit status would be even better, since this avoids re-writing a new config file for each repository each time I enter or exit my LAN.

Comments on this page are closed.