我尝试推送的文件 F
超过了 100 MB 的限制。所以推送失败。然后我删除了该文件,因为无法推送它并假设我需要执行 add 。 ; commit
并再次 push
。在自动生成的提交中,它说 deleted file F
。在 push
之后,它仍然尝试上传该文件。好吧,所以我想我需要取消暂存 F
。所以我做了 reset F
。我收到消息 fatal: ambiguous argument 'out': unknown revision or path not in the working tree.
不知道那是什么意思,所以我试图让 git 向我显示暂存文件 diff --cached
,但输出为空。我对这种情况以及如何解决它感到困惑。
回顾链条:
$> git 添加。 ; git 提交
$> git push
$> 远程:错误:文件 F 为 143.41 MB;这超过了 GitHub 的文件大小限制 100.00 MB
$> rm F
$> git 添加。 ; git 提交
$> git push
$> 远程:错误:文件 F 为 143.41 MB;这超过了 GitHub 的文件大小限制 100.00 MB
$> git diff --cached
$>
最佳答案
问题是该文件已经是历史提交的一部分。
你需要回到提交并修改它:
# reset to previous commit but keeping content:
git reset --soft "HEAD^"
# potentially modify the tree content
# amend the old commit with the file removed:
git commit --amend
# push:
git push
关于git 尝试上传未暂存的已删除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40063332/