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 yougit 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:
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.pngyum install -y git-lfs
you can see git-lfs is installed in your machine:
Screen Shot 2019-02-24 at 10.18.10 AM.pngOnce 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
网友评论