简体   繁体   中英

How can I ignore big files and push to git repo

Before, I used git locally without using .gitignore Afterwards, I created an .gitignore file, and write all unnecessary files in it. When I push them to git repo, fatal: The remote end hung up unexpectedly error appears.

I dont want to push ignore files, but, somehow git tries to push them to repo.

Please help me, what is my fault? Thanks

GitHub has a nice article on this . You basically want to remove the files from Git history, but not from the file system.

  • If your file was pushed in your last commit, you can do:

     git rm --cached path/to/your/big/file git commit --amend -CHEAD git push 
  • If not, they recommend using BFG –a tool for cleaning up repositories ( alternative to git-filter-branch ):

     bfg --strip-blobs-bigger-than 50M 

    This will remove files bigger than 50M.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM