# Setting up digital media masters Digitally stored media master files are often relatively large, and are more likely used as-is than edited. We use git-annex to track such files. As an addon to git, some of the interaction is done through git commands, while some is done using git-annex-specific commands. ## Special strings NB! This documentation uses special strings which you may want to adapt for your local setup: githost: source.example.org gitshellhost: git.example.org ### Paths You are recommended to use path suffix "annex" for media master projects. Examples: * ~/public_annex/home-videos * ~/private_annex/friends-snoring * ~/shared_annex_family/xmas_photos ## Create To turn a folder into a git repository (see also alternative of (cloning)[#Clone] an existing project), go into the folder, and initialize its git and git-annex databases: ```shell git init git annex init ``` To use git-annex only for large files (git for smaller ones), add e.g. the following to file `.gitattributes`: ```shell git config annex.largefiles 'largerthan=100kb and not (mimetype=text/*)' ``` Finally, save all content: ```shell git add . git commit -m "Initial commit" ``` (final `git commit` is implied by a later `git annex sync` or `git annex move`) ## Clone To collaborate on a shared git repository, create a local clone from the shared location, and tell git-annex to use it: ```shell git clone git.example.org:/srv/git/source.example.org/example git annex init ``` ### Publish To publish a git repository initially created locally, first create a new empty git and git annex publicly, then tell your local git where its new origin will be, and finally push your local git and git annex into its new public location: ```shell ssh git.example.org git init --bare --shared /srv/git/source.example.org/example.git ssh git.example.org GIT_DIR=/srv/git/source.example.org/example.git git annex init git remote add origin git.example.org:/srv/git/source.example.org/example.git git push --set-upstream origin master git annex sync --content --all ``` ## References * [Source of this document][media-master] [media-master]: https://source.redpill.dk/media-master "Digital media master material"