Using .gitignore

rails
git

#1

Hi, I am running a Ruby project on c9. It seems however, that my .gitignore file does not work. Does anyone have a similar problem or know a solution?


#2

Hi,

As Cloud9 uses the standard git command, I’m not sure why there’s a problem with .gitignore. Can you paste us a screenshot showing the problem?

Regards,
​Mutahhir


#3

The .gitignore works just fine for me. The file must be in the root folder of your repository to apply though.


#4

Thanks for the response. That is odd indeed. Im not an experienced user, so it might be I’m doing something wrong.

My latest pull:

My workspace/.gitignore file:

/.bundle
/log/.log
/tmp
tmp/pids/

/spring/*.pid
/config/database.yml

Both /log/development.log and /config/database.yml are overwritten in my pulls.

Am I missing something here?

Thanks in advance,

Matthias


#5

Remove the first forward slash. That’s implying that it should look at the root of the file system, not the current directory.


#6

This is my .gitignore file. Note the lack of forward slashes. When you exclude a folder, its contents are ignored as well.

.bundle
.DS_Store
.sass-cache
.gist-cache
.pygments-cache
_deploy
public
sass.old
source.old
source/_stash
source/stylesheets/screen.css
vendor
node_modules
Gemfile.lock

#7

To add to @jms1989’s answer, and I could be wrong here, but once you’ve committed a file to your git, it will stay there regardless of your .gitignore setting. You will have to manually remove the files from source control using something like the git rm command.


#8

Thank you both for your answers, and I apologise for being .ignorant on this matter. It now works after removing the forward slashes and running the commands:

git rm --cached [path]
git update-index --assume-unchanged [path]

Thanks again. C9 is awsome!