Handling large media files in Git
GitMedia extension allows you to use Git with large media files without storing the media in Git itself.
Setup the attributes filter settings.
(once after install)
$ git config filter.media.clean "git-media filter-clean"
$ git config filter.media.smudge "git-media filter-smudge"Setup the .gitattributes file to map extensions to the filter.
(in repo - once)
$ echo "*.mov filter=media -crlf" > .gitattributesStaging files with those extensions will automatically copy them to the media buffer area (.git/media) until you run 'git media sync' wherein they are uploaded. Checkouts that reference media you don't have yet will try to be automatically downloaded, otherwise they are downloaded when you sync.
Next you need to configure git to tell it where you want to store the large files. There are five options:
Here are the relevant sections that should go either in ~/.gitconfig (for global settings)
or in clone/.git/config (for per-repo settings).
[git-media]
transport =
autodownload =
# settings for scp transport
scpuser =
scphost =
scppath =
# settings for local transport
localpath =
# settings for s3 transport
s3bucket =
s3key =
s3secret =
# settings for atmos transport
endpoint =
uid =
secret =
tag =
# settings for webdav transport
webdavurl =
# user and password are taken from netrc if omitted
webdavuser =
webdavpassword =
webdavverifyserver =
webdavbinarytransfer =
(in repo - repeatedly)
$ (hack, stage, commit)
$ git media syncYou can also check the status of your media files via
$ git media statusWhich will show you files that are waiting to be uploaded and how much data that is. If you want to upload & delete the local cache of media files, run:
$ git media clearIf you want to replace file in git-media with changed version (for example, video file has been edited), you need to explicitly tell git that some media files has changed:
$ git update-index --really-refreshIf autodownload is set to true, required files will automatically be downloaded when checking out or pulling. Default is false
$ git config --global media.autodownload true$ git clone [email protected]:alebedev/git-media.git
$ cd git-media
$ sudo gem install bundler
$ bundle install
$ gem build git-media.gemspec
$ sudo gem install git-media-*.gemIt is important to switch off git smart newline character support for media files.
Use -crlf switch in .gitattributes (for example *.mov filter=media -crlf) or config option core.autocrlf = false.
If installing on windows, you might run into a problem verifying certificates for S3 or something. If that happens, see the instructions in this Gist for how to update your RubyGems to the proper certificates.
Copyright (c) 2009 Scott Chacon. See LICENSE for details.
No open issues yet, or sync has not completed.