我如何忽略大文件并推送到git repo [英] How can I ignore big files and push to git repo
问题描述
之前,我在本地使用git而不使用 .gitignore
之后,
我创建了一个 .gitignore
文件,并在其中写入所有不必要的文件。
当我把它们推到git repo时,致命的:远端意外挂起错误出现。
我不想推忽略文件,但不知何故git试图推动他们回购。
请帮助我,我的过错是什么?谢谢
GitHub有一个的不错文章。您基本上想要从Git历史记录中删除文件,但不是从文件系统中删除文件。 如果您的文件被推入最后一次提交,你可以这样做: 如果不是,他们推荐使用 这将删除大于50M的文件。
git rm --cached path / to / your / big / file
git commit --amend -CHEAD
git push
BFG
- 一种工具清理仓库(
bfg --strip-blobs -bigger-than 50M
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.
这篇关于我如何忽略大文件并推送到git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!