简体   繁体   中英

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. In my .gitignore file, I have tmp/ so I don't understand why they keep showing up...here is my .gitignore file for reference:

# 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. Thanks for any and all help!

Try removing the files with 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.

Step 1 : specify all files in .gitignore

/log/* .log /tmp/ !/log/.keep !/tmp/.keep

Step 2: clear your git cache git rm -r --cached tmp/

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