3

So I tried everything but to no avail I keep getting the following error "fatal: cannot use tmp/ as an exclude file" I have even tried using /tmp and tmp/* but none of these two work either . Finally I deleted the tmp folder in frustration and i found that git now works perfectly

SO I have two questions.

  1. The obvious one being . How do I get this to work?

  2. Is it possible for me to run my ruby on rails applications without the tmp folder?

yugonline
  • 73
  • 1
  • 5

2 Answers2

8

The obvious one being . How do I get this to work?

Add /tmp to your .gitignore at the root of your Rails app. Make sure you add and commit this .gitignore before committing /tmp — you'd have to git rm it to make it disappear from the repository again.

Is it possible for me to run my ruby on rails applications without the tmp folder?

No. Why would you? Rails needs to be able to write files there in order to work properly. You can only symlink it somewhere else, but that won't really solve the issue if the files are included in your repository. See also: Rails3: Change location of temp (tmp) directory

Community
  • 1
  • 1
slhck
  • 36,575
  • 28
  • 148
  • 201
  • I have done this too. :O When I try to git add the .gitignore file it returns the same fatal error I mentioned in my question :( – yugonline Nov 23 '13 at 17:35
  • It should work. So you're sure you are in the Rails directory, editing `.gitignore`, and it has `/tmp` in there? Do a `git rm -r tmp`, then `git commit -m "Remove tmp"`. Does that work? – slhck Nov 23 '13 at 18:04
  • Wait it says now that 'tmp' did not match any files .. And yes I am in my rails directory and I have initialised i.e `git init` done in this directory itself. – yugonline Nov 23 '13 at 18:14
  • Then `tmp` is not a directory in your current folder or it's actually not in your repository anymore. – slhck Nov 23 '13 at 18:15
  • Seeing that won't really help – you'd need to give us a little more info in your question, e.g. a `ls -l` of the directory, the full contents of your gitignore, a `git status` as well as a `git status tmp`. – slhck Nov 23 '13 at 18:44
1

It may have to do with the way git works with cached files that the folder may still show up after including it in the .gitignore file.

Try git rm . -r --cached in the command line to clear out the cached files.

Felix
  • 1,837
  • 9
  • 26
bqh5026
  • 21
  • 2