当前位置:   article > 正文

Git LFS(大文件存储)教程_git lfs下载大文件

git lfs下载大文件

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

9、推送其他文件

git push -u origin master

3 官方说明

  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[1] 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
  • 1
  • 2
  • 3
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/760467
推荐阅读
相关标签
  

闽ICP备14008679号