pmerino
pmerino

Reputation: 6130

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 :(

Upvotes: 5

Views: 5548

Answers (3)

user1394623
user1394623

Reputation:

Take a look at a sample .gitignore file at: https://github.com/github/gitignore/blob/master/Rails.gitignore

I also found a good article at http://www.wrel.de/gitignore-und-was-kommt-rein/ (German)

Upvotes: 1

Rohan Singh
Rohan Singh

Reputation: 21465

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.

Upvotes: 10

thenetimp
thenetimp

Reputation: 9820

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

Upvotes: 5

Related Questions