美文网首页
Versioning Large File in Git

Versioning Large File in Git

作者: 海胆阶段 | 来源:发表于2019-02-25 02:53 被阅读12次

I want to introduce you Git LFS, it is a command line extension and specification for managing large files with Git. LFS is great for large, changing files, there is basically a text pointer to the large file archived some place else.

Install Git LFS

Note: you need to install Git LFS if you git pull from a remote repository that has it

For example, I am working on a RHEL machine.
First go to source page, follow the installation guide to install:

$6088EB4DE193BD02.jpg Screen Shot 2019-02-24 at 10.03.19 AM.png

This will create a yum repos for git-lfs:

Screen Shot 2019-02-24 at 10.08.33 AM.png Screen Shot 2019-02-24 at 10.09.49 AM.png
yum install -y git-lfs

you can see git-lfs is installed in your machine:

Screen Shot 2019-02-24 at 10.18.10 AM.png

Once downloaded and installed, set up Git LFS and its respective hooks by running:

git lfs install
Screen Shot 2019-02-24 at 10.12.02 AM.png

Note: You'll need to run this in your repository directory, once per repository.

Track Large File

Select the file types you'd like Git LFS to manage (or directly edit your .gitattributes). You can configure additional file extensions at anytime.

git lfs track "*.tar.gz"

Note: run this track command at the top level of your repository, then you need to git add .gitattributes file

Manage Large File

Then, just do normal git add and git commit to manage your large size file.

git add *.tar.gz
git commit -m "add tar.gz file"
git push origin <your branch>
Screen Shot 2019-02-24 at 10.28.40 AM.png

Actually, you can check the large files you managed by running:

git lfs ls-files

相关文章

网友评论

      本文标题:Versioning Large File in Git

      本文链接:https://www.haomeiwen.com/subject/trniyqtx.html