2016-10-15 33 views
0

我有一个文件F,超过了我尝试推送的100 MB限制。所以推送失败了。然后我删除了该文件,因为它无法推送并假定我需要再次执行add . ; commitpush。在自动生成的提交中,它表示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 add. ; git commit

$> git push

$> remote: error: File F is 143.41 MB; this exceeds GitHub's file size limit of 100.00 MB

$> rm F

$> git add. ; git commit

$> git push

$> remote: error: File F is 143.41 MB; this exceeds GitHub's file size limit of 100.00 MB

$> git diff --cached

$>

+0

你有你的大文件在一些较老的承诺。你需要重写历史来摆脱它。您可以随时使用'gitk'提供的图形界面检查您的本地历史记录。 'git log --name-only'也是你的朋友。使用git commit --amend或'git reabse -i'来重写历史记录。 –

回答

1

的问题是,该文件已经是历史的承诺的一部分。

你需要找回的提交和修改它:

# 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 
+0

谢谢,这是做到了。第一条命令究竟做了什么?什么是“HEAD ^”? –

+0

@lotolmencre:标识头部之前的提交。 –