GIT LFS 使用笔记

一、背景

  由于git上传文件大小受限,所以我们需要使用GIT LFS对大小超过一定上限的大文件进行处理。

二、安装

  linux上安装参见 https://askubuntu.com/questions/799341/how-to-install-git-lfs-on-ubuntu-16-04

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash

sudo apt-get install git-lfs

  在我的ubuntu16.04上我一直卡在第一条命令,所以我选择的是windows版GIT LFS(https://git-lfs.github.com/)

  下载完git-lfs-windows-v2.5.2.exe后双击,按照步骤进行安装。然后执行 git lfs install

三、使用,参考https://blog.csdn.net/code_segment/article/details/78597416 

  # Add all zip files through Git LFS
  $ git lfs track "*.zip"

  $ git add .gitattributes

  $ git add my.zip
  $ git commit -m "add zip"

  $ git lfs ls-files
  my.zip

  $ git remote add origin https://github.com/Agzs/gopath.git

  $ git push origin master

  在这里一定要用git lfs ls-files查看一下,我用直接track文件的方式就没有在这里显示出我要托管的文件。

原文地址:https://www.cnblogs.com/lucifer1997/p/9877535.html