While git-annex can be [[installed_on_your_Android_device|/Android]], it might be easier not to install it there, but run it on your computer using `adb` to pull and push changes to the Android device. A few reasons for going this route: * Easier than installing git-annex on Android. * Avoids needing to type commands into a terminal on Android. * Avoids problems with putting a git-annex repository on Android's `/sdcard`, which is crippled by not supporting hard links etc. All you should need is a USB cable (or adb over wifi), and the `adb` command. ## setting it up First, initialize your git-annex repository on your computer, if you haven't already. Then, in that repository, set up an adb special remote: initremote android type=adb androiddirectory=/sdcard/DCIM encryption=none exporttree=yes importtree=yes The above example imports files from the /sdcard/DCIM directory of the Android device, so it will only import photos and videos, not other files. If you wanted to import everything, you could instead use "androiddirectory=/sdcard". Next, configure how file trees imported from it will be merged into your git repository. git config remote.android.annex-tracking-branch master:android Setting "master:android" makes the phone be treated as containing a branch of the master branch, and makes all its files appear to be inside a subdirectory named `android`. If you want its files to not be in a subdirectory, set it to "master" instead. ## syncing with it git annex sync --content android This command does a bi-directional sync with the phone, first importing new and changed files from it, merging that into the master branch, and then exporting from the master branch back to the android device so any modifications you have made get synced over to it. See [[git-annex-import, [[git-annex-export]], and [[git-annex-sync]] for more details, and bear in mind that you can also use commands like these to only import from or export to the android device: git annex import master:android --from android git merge android/master git annex export master:android --to android ## sample workflows ### photos The examples above showed how to import photos from your Android device into an android subdirectory. If you don't want to keep old photos on your Android device, you can simply `git mv` the files out of the android directory, and the next sync with the phone will delete them from the Android device: git mv android/* . git annex sync --content ### music and podcasts Set up the remote to use the /sdcard/Music directory: initremote android type=adb androiddirectory=/sdcard/Music encryption=none exporttree=yes importtree=yes The annex-tracking-branch can be the same as before, to limit the files that are synced to those in an android directory: git config remote.android.annex-tracking-branch master:android And then do an initial sync: git annex sync --content android Now, you can copy music and podcasts you want to listen to over to the Android device, by first copying them to the Android directory of your git-annex repo: cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/ git annex add android git annex sync --content android Once you're done with listening to something on the Android device, you can simply delete on the device, and the next time git-annex syncs, it will get removed from the android directory. Or, you can delete it from the android directory and the next sync will delete it from the Android device.