fatal: sha1 file '<stdout>' write error: Broken pipe

解决

使用Git LFS

  1. 在官网 https://git-lfs.github.com/ 下载git-lfs-windows-v2.8.0.exe并安装。
  2. 新开一个bash命令行输入git lfs install安装
  3. 跟踪你要push的大文件git lfs track "*.h5",这时会生成一个.gitattributes文件。
  4. 这里很重要,一定要先将上一步生成的.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

 

posted on 2023-10-09 11:53  tycoon3  阅读(823)  评论(0)    收藏  举报

导航