.gitignore for Rails + Ruby
Complete .gitignore for Ruby on Rails applications.
Quick presets
Selected (2)
RailsRuby
Your selections never leave your browser. Generation happens entirely client-side.
36 patterns · 661 B
# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator # Templates: Ruby, Rails # 2026-04-20 # ---- Ruby ---- # Ruby *.gem *.rbc /.config /coverage/ /InstalledFiles /pkg/ /spec/reports/ /spec/examples.txt /test/tmp/ /test/version_tmp/ /tmp/ .dat* .repl_history build/bundled_gems Gemfile.lock .ruby-version .ruby-gemset .rvmrc .byebug_history # ---- Rails ---- # Rails /log/* !/log/.keep /storage/* !/storage/.keep /public/assets /public/packs /public/packs-test /db/*.sqlite3 /db/*.sqlite3-journal /db/*.sqlite3-shm /db/*.sqlite3-wal config/master.key config/credentials/*.key /config/database.yml node_modules/ .env* !.env.example
Why use Rails + Ruby together?
Ruby on Rails applications need both Ruby language artifacts (*.rbc bytecode, gem artifacts) and Rails-specific ignores (log/, tmp/, SQLite databases, uploaded storage files, compiled assets).
The most critical Rails-specific ignore is config/master.key — this file decrypts credentials.yml.enc which contains all your production secrets. If master.key is ever committed and the repository is public or compromised, you must rotate all credentials immediately.
Related combinations
Frequently asked questions
- Do I need to commit .gitignore?
- Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
- How do I add custom patterns?
- Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
- How do I ignore a file that is already tracked?
- Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
- Why combine Rails and Ruby?
- Ruby on Rails applications need both Ruby language artifacts (*.rbc bytecode, gem artifacts) and Rails-specific ignores (log/, tmp/, SQLite databases, uploaded storage files, compiled assets).
Looking for something else? Browse all templates →