美文网首页
Git 大文件使用

Git 大文件使用

作者: 天空中的球 | 来源:发表于2021-11-04 01:00 被阅读0次

Git 提交的时候,超过限制会上传不上去,此时 LFS 就派上用场啦

  • 安装,我是用的是Macbook Pro,所以选择macOS用户安装方式Homebrew安装
    brew install git-lfs
  • 打开终端,cd到git仓库本地路径,初始化lfs
    git lfs install
  • 追踪单个文件
    git lfs track
    eg:git lfs track "*.psd"
  • 添加lfs追踪文件,提交仓库(此处一定要先提交追踪文件到仓库,在提交其他文件)
    git add .gitattributes
    git commit -m "track *.psd files using Git LFS"
    git add .
    git commit -m "submit other files"
  • 验证是否追踪大文件,如果输入后不显示则追踪不成功
    git lfs ls-files
  • 推送至远程仓库
    git push origin master
例子1 例子2

摘抄来源于: https://zhuanlan.zhihu.com/p/65131817

相关文章

网友评论

      本文标题:Git 大文件使用

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