Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git ignoring my .gitignore on a Rails project

I'm having some deployment problems, due to Rails' tmp/cache/assets folder and git not ignoring tmp/* or tmp/. My entire .gitignore is:

*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html

It's taken from GitHub gitignore repo. What can I do to fix it? I get tons of errors due to local changes (in the tmp/ folder) on my server, such as error: Your local changes to 'tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705' would be overwritten by merge. Aborting., so I can't deploy on my dev machine :(

like image 983
pmerino Avatar asked Mar 04 '12 10:03

pmerino


2 Answers

Did you add the .gitignore after starting the project? If tmp/cache/assets/whatever already existed before you added the .gitignore, it'll still be in the repo.

  1. Try a git rm -r tmp && git commit to remove the whole tmp directory from the repo.

  2. Try deploying at this point to see if deployment works from a known-good state. If it still doesn't work, you know there is some other issue.

  3. If everything works, new changes to tmp should no longer be picked up.

ALso, as @thenetimp points out, your current .gitignore will only ignore /tmp, but not something/tmp. I'm not sure if that's your intention or not.

like image 73
Rohan Singh Avatar answered Sep 27 '22 22:09

Rohan Singh


remove the forward slash in front of /tmp/ it should be tmp/

like image 32
thenetimp Avatar answered Sep 27 '22 22:09

thenetimp