What files should be inserted in .gitignore in a Rails project?

2

I'm starting in Git and also in Ruby on Rails. I created a new project using rails new myapp -d mysql and added it to my GitHub repository. When creating the project rails generates several files.

So far so good, but it turns out that some files, which contain database password - config/database.yml (for example) have been uploaded to the repository.

I would like to know which files are recommended in .gitignore, so that I do not expose my security information, or unnecessary files that are not normally added to the repository.

    
asked by anonymous 26.05.2015 / 16:03

1 answer

2

Regardless of the language for my projects, I always start with the GitHub template. And edict based on my preferences.

You can find Ruby here: link

Below the content of the file in case of dead link .

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/test/tmp/
/test/version_tmp/
/tmp/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalisation:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

And here for Rails: link

You can add config/database.yml to .gitignore so that it is ignored, if it is a public repository and / or you do not want to expose your database password.

*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html

# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/secrets.yml

## Environment normalisation:
/.bundle
/vendor/bundle

# these should all be checked in to normalise the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv
    
26.05.2015 / 16:12