.gitignore for Ruby on Rails
38 ignore rules for Ruby on Rails, ready to copy into your repository.
Web application framework for Ruby
The complete .gitignore for Ruby on Rails
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:31:22 UTC
# Technologies: Ruby on Rails
### Ruby on Rails ###
# Ruby compiled bytecode
*.rbc
capybara-*.html
# RSpec configuration
.rspec
# Original file backup
*.orig
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-[0-9]*
/public/system
# Code coverage reports
/coverage/
/spec/tmp
rerun.txt
pickle-email-*.html
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
config/initializers/secret_token.rb
config/master.key
# Environment variables
.env
.env*.local
# Bundler config
/.bundle
# Bundled gems
/vendor/bundle
# RVM configuration
.rvmrc
/vendor/assets/bower_components
*.bowerrc
bower.json
.powenv
.byebug_history
# Node.js dependencies
node_modules/
/public/packs
/public/packs-test
/public/assets
/yarn-error.log
# Yarn debug logs
yarn-debug.log*
.yarn-integrity
/storage/*
!/storage/.keep
/public/uploads
What these Ruby on Rails rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
*.rbc |
Ruby compiled bytecode |
capybara-*.html |
General |
.rspec |
RSpec configuration |
*.orig |
Original file backup |
/db/*.sqlite3 |
General |
/db/*.sqlite3-journal |
General |
/db/*.sqlite3-[0-9]* |
General |
/public/system |
General |
/coverage/ |
Code coverage reports |
/spec/tmp |
General |
rerun.txt |
General |
pickle-email-*.html |
General |
Ignore all logfiles and tempfiles.
| Pattern | What it ignores |
|---|---|
/log/* |
Ignore all logfiles and tempfiles. |
/tmp/* |
Ignore all logfiles and tempfiles. |
!/log/.keep |
Ignore all logfiles and tempfiles. |
!/tmp/.keep |
Ignore all logfiles and tempfiles. |
TODO Comment out this rule if you are OK with secrets being uploaded to the repo
| Pattern | What it ignores |
|---|---|
config/initializers/secret_token.rb |
TODO Comment out this rule if you are OK with secrets being uploaded to the repo |
config/master.key |
TODO Comment out this rule if you are OK with secrets being uploaded to the repo |
TODO Comment out these rules if environment variables can be committed
| Pattern | What it ignores |
|---|---|
.env |
Environment variables |
.env*.local |
TODO Comment out these rules if environment variables can be committed |
/.bundle |
Bundler config |
/vendor/bundle |
Bundled gems |
.rvmrc |
RVM configuration |
/vendor/assets/bower_components |
if using bower-rails ignore default bower_components path bower.json files |
*.bowerrc |
TODO Comment out these rules if environment variables can be committed |
bower.json |
TODO Comment out these rules if environment variables can be committed |
Ignore pow environment settings
| Pattern | What it ignores |
|---|---|
.powenv |
Ignore pow environment settings |
Ignore Byebug command history file.
| Pattern | What it ignores |
|---|---|
.byebug_history |
Ignore Byebug command history file. |
Ignore node_modules
| Pattern | What it ignores |
|---|---|
node_modules/ |
Node.js dependencies |
Ignore precompiled javascript packs
| Pattern | What it ignores |
|---|---|
/public/packs |
Ignore precompiled javascript packs |
/public/packs-test |
Ignore precompiled javascript packs |
/public/assets |
Ignore precompiled javascript packs |
Ignore yarn files
| Pattern | What it ignores |
|---|---|
/yarn-error.log |
Ignore yarn files |
yarn-debug.log* |
Yarn debug logs |
.yarn-integrity |
Ignore yarn files |
Ignore uploaded files in development
| Pattern | What it ignores |
|---|---|
/storage/* |
Ignore uploaded files in development |
!/storage/.keep |
Ignore uploaded files in development |
/public/uploads |
Ignore uploaded files in development |
How to use this .gitignore for Ruby on Rails
- Copy the Ruby on Rails rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.