本文主要是介绍Git Large File Storage (LFS) 的安装与使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Git Large File Storage [LFS] 的安装与使用
- 1. An open source Git extension for versioning large files
- 2. Installing on Linux using packagecloud
- 3. Getting Started
- References
1. An open source Git extension for versioning large files
https://git-lfs.com/
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
https://github.com/git-lfs/git-lfs
Git LFS is a command line extension and specification for managing large files with Git.
The client is written in Go, with pre-compiled binaries available for Mac, Windows, Linux, and FreeBSD.
2. Installing on Linux using packagecloud
https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md
packagecloud hosts git-lfs packages for popular Linux distributions with apt/deb and yum/rpm based package-managers.
apt/deb: sudo apt-get install git-lfs
(base) yongqiang@yongqiang:~$ sudo apt-get install git-lfs
...
Unpacking git-lfs (2.9.2-1) ...
Setting up git-lfs (2.9.2-1) ...
Processing triggers for man-db (2.9.1-1) ...
(base) yongqiang@yongqiang:~$(base) yongqiang@yongqiang:~$ git-lfs --version
git-lfs/2.9.2 (GitHub; linux amd64; go 1.13.5)
(base) yongqiang@yongqiang:~$
3. Getting Started
(1) Download and install the Git command line extension. Once downloaded and installed, set up Git LFS for your user account by running:
git lfs install
You only need to run this once per user account.
(2) In each Git repository where you want to use Git LFS, 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 "*.psd"
Now make sure .gitattributes
is tracked:
git add .gitattributes
Note that defining the file types Git LFS should track will not, by itself, convert any pre-existing files to Git LFS, such as files on other branches or in your prior commit history. To do that, use the git lfs migrate
command, which has a range of options designed to suit various potential use cases.
(3) There is no step three. Just commit and push to GitHub as you normally would; for instance, if your current branch is named main
:
git add file.psd
git commit -m "Add design file"
git push origin main
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/
[2] Git Large File Storage, https://git-lfs.com/
这篇关于Git Large File Storage (LFS) 的安装与使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!