views:

238

answers:

1

Other than the database and log files are there any other files that should not be in the repository for security reasons?

The project will mostly be worked on by myself however the code is to be stored on a shared repository which will be available to a few other users should they want to pull from it. The project is reasonably simple, so i am not too worried about security in my actual code - this is more to protect any test data etc and to build up 'good practice' in this type of project.

+4  A: 

A typical .gitignore file in a "ruby on rails" context could look something like:

config/database.yml  
db/*.sqlite3
log/*.log
log/*.pid
tmp/**/*"

But, as pointed out by the article "rorgitignore : .gitignore files specific for Ruby on Rails", you can also use .gitignore to add empty directories.

Because git tracks contents, not files, it doesn't save any empty directories, since there is no content to track.

This means that when you clone your project from a git repository, it is missing the log, tmp, lib and other directories.

This small script fixes that, so git adds even empty directories

for DIR in `find . -type d | sed -re 's/\.\///g' | grep -v '^\.git'`; do
    [ `ls -a $DIR | wc -l` -le 2 ] && \
    echo Creating and git-adding $DIR/.gitignore && \
    touch $DIR/.gitignore && \
    git add -f $DIR/.gitignore
done

this just outputs the commands to add an empty .gitignore file to all empty directories in a git project and git add -f'em to the repo.


If you are still focused only on the main .gitignore file, here is a more complete one, from iCoreTech Research Labs

config/database.yml
*~
*.cache
*.log
*.pid
tmp/**/*
.DS\_Store
db/cstore/**
doc/api
doc/app
doc/plugins
coverage/*
db/*.sqlite3
*.tmproj
Capfile
VonC