Git推送大文件

2 阅读1分钟

1.安装 Git LFS

brew install git-lfs 
git lfs install

2.追踪大文件类型

# 匹配 AMapNaviKit 整个目录/文件 
git lfs track "AMapNaviKit" 
# 生成 .gitattributes 并提交这个配置文件 
git add .gitattributes 
git commit -m "use lfs for AMapNaviKit large sdk"

3.直接 push 依然报错,因为历史里还存着原始大 blob,需要迁移:

git lfs migrate import --everything --include="AMapNaviKit"

4.重新推送代码

git push