Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

git-media

> 编程语言
Open source

Handling large media files in Git

345 stars0 likes4 views
WebsiteGitHub

About

Handling large media files in Git

git-media

GitMedia extension allows you to use Git with large media files without storing the media in Git itself.

Configuration

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" > .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 five options:

  1. Storing remotely in Amazon's S3
  2. Storing locally in a filesystem path
  3. Storing remotely via SCP (should work with any SSH server)
  4. Storing remotely in atmos
  5. Storing remotely via WebDav

Here are the relevant sections that should go either in ~/.gitconfig (for global settings) or in clone/.git/config (for per-repo settings).

ini
[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 = 

Usage

(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

If 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-refresh

Config Settings

If 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

Installing

$ 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-*.gem

Notes for Windows

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, see the instructions in this Gist for how to update your RubyGems to the proper certificates.

Copyright

Copyright (c) 2009 Scott Chacon. See LICENSE for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言