[英]Git is not ignoring tmp files
I'm having this annoying issue in a Ruby On Rails application where git keeps committing these tmp/
files.我在 Ruby On Rails 应用程序中遇到了这个烦人的问题,其中 git 不断提交这些tmp/
文件。 In my .gitignore
file, I have tmp/
so I don't understand why they keep showing up...here is my .gitignore
file for reference:在我的.gitignore
文件中,我有tmp/
所以我不明白它们为什么一直出现……这是我的.gitignore
文件以供参考:
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp/
/public/system/*
/vendor/cache/
# OS generated cache files
Thumbs.db
DS_Store
It's just a minor issue that is getting annoying to my team and I on the repo.这只是一个让我的团队和我在 repo 上感到恼火的小问题。 Thanks for any and all help!感谢您的任何帮助!
Try removing the files with git rm
.尝试使用git rm
删除文件。 Maybe a command like this will work:也许这样的命令会起作用:
git rm -R tmp
Then make a commit to record that you have removed the files from git, and git will stop trying to track changes to those files.然后进行提交以记录您已从 git 中删除文件,并且 git 将停止尝试跟踪对这些文件的更改。
Step 1 : specify all files in .gitignore第 1 步:指定 .gitignore 中的所有文件
/log/* .log /tmp/ !/log/.keep !/tmp/.keep /log/* .log /tmp/ !/log/.keep !/tmp/.keep
Step 2: clear your git cache git rm -r --cached tmp/第 2 步:清除您的 git 缓存git rm -r --cached tmp/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.