git超过10MB的文件push失败怎么解决

# 1. 确保已安装并初始化 LFS
git lfs install

# 2. 扫描出所有 >10M 的文件,并一一 track
find filesForAndroid -type f -size +10M -print0 \
  | xargs -0 -n1 git lfs track

# 3. 提交更新后的 .gitattributes
git add .gitattributes
git commit -m "chore: LFS-track all >10M files under filesForAndroid"

# 4. 把这些大文件从普通索引中移除并重新添加,让 LFS 拦截
find filesForAndroid -type f -size +10M -print0 \
  | xargs -0 -n1 git rm --cached

find filesForAndroid -type f -size +10M -print0 \
  | xargs -0 -n1 git add

# 5. 提交并推送
git commit -m "chore: move all >10M files under filesForAndroid into LFS"
git push origin master

你可能感兴趣的:(git)