0 简介
Git LFS(Large File Storage)是由 Atlassian, GitHub 以及其他开源贡献者开发的 Git 扩展,它通过延迟地(lazily)下载大文件的相关版本来减少大文件在仓库中的影响,具体来说,大文件是在 checkout 的过程中下载的,而不是 clone 或 fetch 过程中下载的(这意味着你在后台定时 fetch 远端仓库内容到本地时,并不会下载大文件内容,而是在你 checkout 到工作区的时候才会真正去下载大文件的内容)。
2 GitHub上传大文件
1、创建本地仓库
git init
2、安装git lfs(一个仓库里面执行一次就好了)
git lfs install
3、使用lfs来追踪(管理)大文件
git lfs track "*.pth"
4、添加.gitattributes配置文件(否则其他git操作可能会有问题)
git add .gitattributes
5、上传文件
git add *
6、提交文件
git commit -m "first commit"
7、关联本地与远程的仓库
git remote add origin Your_SSH
8、推送大文件文件
git push -u origin master
文章来源地址https://www.toymoban.com/news/detail-723813.html文章来源:https://www.toymoban.com/news/detail-723813.html
9、推送其他文件
git push -u origin master
3 官方说明
- 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. - 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[1] command, which has a range of options designed to suit various potential use cases. - 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
到了这里,关于Git LFS(大文件存储)教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!