百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

git-media

> 编程语言
开源

在 Git 中处理大型媒体文件

345 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

在 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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