git 上传了一个非常大的文件,删除文件

50Mb push 警告

remote: warning: Large files detected.

# remote: warning: File big_file is 55.00 MB; this is larger than GitHub's recommended maximum file size of 50 MB


100Mb push 限制 

remote: warning: Large files detected.
# remote: error: File giant_file is 123.00 MB; this exceeds GitHub's file size limit of 100 MB

解决方案如下:

1、需要在服务器上用git filter-branch --tree-filter 'rm -f 文件名' HEAD把文件彻底从库中删除

    如: git filter-branch --tree-filter 'rm -f app.rar' HEAD


2、移除大文件,注意备份

$git rm --cached giant_file
# Stage our giant file for removal, but leave it on disk


$git commit --amend -CHEAD
# Amend the previous commit with your change
# Simply making a new commit won't work, as you need
# to remove the file from the unpushed history as well


$git push
# Push our rewritten, smaller commit

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页