解决
使用Git LFS
- 在官网 https://git-lfs.github.com/ 下载git-lfs-windows-v2.8.0.exe并安装。
- 新开一个bash命令行输入
git lfs install
安装 - 跟踪你要push的大文件
git lfs track "*.h5"
,这时会生成一个.gitattributes文件。 - 这里很重要,一定要先将上一步生成的.gitattributes文件上传到仓库也就是要上传三部曲
git add .gitattributes
git commit -m "add .gitattributes"
git push origin master
注意:如果按照上述步骤依然报错,说明是在安装LFS之前已经提交大文件失败过了,这时需要回滚到失败之前的那次commit。
1 git log 查看日志,找到上次失败提交的commit_id,复制下来,然后输入
1 git reset --hard commit_id
#commit_id为复制的内容 注意,此操作会将提交失败的源文件也删除,所以注意备份。
回退到上一次commit的状态
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
解决方案:
git reset HEAD^ --soft
标签:write,sha1,pipe,git,master,lfs,commit,id,gitattributes From: https://www.cnblogs.com/dream397/p/17751404.html