英文:
.gitignore not working for me; trying to ignore all .csv files in all directories
问题
I've read lots of posts already, and I've tried what I've found (ie creating my .gitignore
file with the SINGLE LINE *.csv
within the root directory (ie the same directory containing the .git
folder (that's the root directory, right?), then running git rm -r --cached .
followed by git add .
followed by git commit -m "so tired of trying to ignore all csv files"
followed by git push origin master
. And yet, I still get many errors, all looking like:
remote: error: File zz_prep_stuff/z_csv_table_data/blah.csv is 485.89 MB; this exceeds GitHub's file size limit of 100.00 MB
So, clearly, something is wrong! Again, my .gitignore
file contains only the following code:
*.csv
Please advise! Where am I going wrong? How do I ignore ALL csv files in my project? Thank you
英文:
I've read lots of posts already, and I've tried what I've found (ie creating my .gitignore
file with the SINGLE LINE *.csv
within the root directory (ie the same directory containing the .git
folder (that's the root directory, right?), then running git rm -r --cached .
followed by git add .
followed by git commit -m "so tired of trying to ignore all csv files"
followed by git push origin master
. And yet, I still get many errors, all looking like:
remote: error: File zz_prep_stuff/z_csv_table_data/blah.csv is 485.89 MB; this exceeds GitHub's file size limit of 100.00 MB
So, clearly, something is wrong! Again, my .gitignore
file contains only the following code:
*.csv
Please advise! Where am I going wrong? How do I ignore ALL csv files in my project? Thank you
答案1
得分: 2
但是... 如果
blah.csv
过去已经提交到你的代码库,即使你将其添加到.gitignore
文件中,Git仍然会跟踪它。.gitignore
文件只会忽略未跟踪的文件,不会忽略已经提交到代码库的文件。
你应该使用git filter-repo
(首先需要安装)来从你的历史记录中清除那些.csv
文件(注意:先备份你的代码库):
git filter-repo --path-glob '*.csv' --invert-paths
git push origin --force --all
这是基于路径的过滤。
英文:
> And yet, I still get many errors,
But... if blah.csv
has been committed to your repository in the past, it would still tracked by Git even if you add it to the .gitignore
file.
The .gitignore
file only ignores untracked files and does not ignore files that have already been committed to the repository.
You should use git filter-repo
(to be installed first) in order to purge those .csv
files from your past history (note: backup your repository first):
git filter-repo --path-glob '*.csv' --invert-paths
git push origin --force --all
It is using a Filtering based on paths.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论