large file not getting removed from commit

I added and committed a large file by mistakeץ when trying to push to remote i get an error

git push

Counting objects: 417, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (390/390), done.

Writing objects: 100% (417/417), 104.63 MiB | 315.00 KiB/s, done.

Total 417 (delta 207), reused 0 (delta 0)

remote: Resolving deltas: 100% (207/207), completed with 163 local objects.

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

remote: error: Trace: *******

remote: error: See http://git.io/iEPt8g for more information.

remote: error: File * is 165.27 MB; this exceeds GitHub's file size limit of 100.00 MB To git@github.com:*** ! [remote rejected] dev -> dev (pre-receive hook declined)

error: failed to push some refs to 'git@github.com:****'

I added the file to gitignore and removed it from cache with :

git rm -r --cached */*
git add -A
git commit -am 
git push

and i get the same error.

SO i removed the file from my local directory and still the same error.

What can i do to remove it from my commit? Thanks


If I understand your question correctly, you have committed the wrong file locally, but haven't pushed your changes yet.

If the commit with the file is the last one, than simple git reset HEAD~ will give you an opportunity to remove the file and redo the commit.

If the commit is deeper, you can perform git rebase -i <base_commit> and edit the necessary commit, removing the file.

Also see this

链接地址: http://www.djcxy.com/p/23178.html

上一篇: Git合并本地克隆上的远程拉取请求

下一篇: 大文件没有从提交中删除