GitMedia extension allows you to use Git with large media files without storing the media in Git itself.
$ sudo gem install trollop $ sudo gem install s3 $ sudo gem install right_aws $ gem build git-media.gemspec $ sudo gem install git-media-0.1.1.gem
Once after install:
$ git config filter.media.clean "git-media filter-clean" $ git config filter.media.smudge "git-media filter-smudge"
There is a separate version of the filter scripts, writtin in bash shell script. These are much faster than the ruby version, but may not support all the features.
In each repo where you desire to use git-media, setup the .gitattributes file to map file extensions to the git-media filter.
In each repo (once):
$ echo "*.<extension> filter=media" > .gitattributes
Staging 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 three options:
-
Storing remotely in Amazon’s S3
-
Storing locally in a filesystem path
-
Storing remotely via SCP (should work with any SSH server)
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 = <scp|local|s3> # settings for scp transport scpuser=<user> scphost=<host> scppath=<path_on_remote_server> # settings for local transport localpath=<local_filesystem_path> # settings for s3 transport s3bucket=<name_of_bucket> s3key=<s3 access key> s3secret=<s3 secret key>
$ git config --global media.auto-download false
(in repo - repeatedly) $ (hack, stage, commit) $ git media sync
You can also check the status of your media files via
$ git media status
Which 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 clear
It 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, modify C:Ruby191librubygems1.9.1gemsright_http_connection-1.2.4libright_http_connection.rb And add at line 310, right before “@http.start”:
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Copyright © 2009 Scott Chacon. See LICENSE for details.