github/gitignore · Ruby.gitignore

Ruby .gitignore Template Explained

Why Ruby.gitignore ignores gem packages, Bundler install folders, test results and generated docs, and when to commit Gemfile.lock and .ruby-version.

Open in generator Open with Rails, macOS, JetBrains

Ruby.gitignore is for projects that build gems or develop Ruby scripts and applications. Most of its rules start with / and are anchored to the repository root, so it rarely ignores a subfolder with the same name by mistake.

For Rails applications, the Rails template covers more cases than this one. If you select both, the overlapping rules are cleaned up by duplicate removal.

Rules explained

PatternWhat it ignores and why
*.gem/pkg/Gem packagesPackage files produced by gem build and rake build. They are artifacts published to RubyGems.
/.bundle//vendor/bundle/lib/bundler/man/Bundler.bundle/ holds local Bundler settings and vendor/bundle holds gems installed with bundle install --path. They can be reinstalled on another computer.
/coverage//spec/reports//spec/examples.txt/test/tmp//test/version_tmp/Test resultsRun results such as SimpleCov output, RSpec reports and examples.txt, in which RSpec remembers failed examples.
/.yardoc//_yardoc//doc//rdoc/Generated documentationAPI documentation and caches produced by YARD and RDoc. They are regenerated from source comments.
/tmp/.byebug_history.repl_history*.rbc/.config/InstalledFilesTemporary and debugger filesThe temp folder, byebug and REPL history, Rubinius bytecode and setup.rb install records.
.rvmrcVersion manager settingsRVM's old per-project settings file. It can execute shell code, so avoid sharing it. Nowadays .ruby-version is mostly used instead.

Practical notes

Original template

Ruby.gitignore26 rules
*.gem*.rbc/.config/coverage//InstalledFiles/pkg//spec/reports//spec/examples.txt/test/tmp//test/version_tmp//tmp/# Used by dotenv library to load environment variables.# .env# Ignore Byebug command history file..byebug_history## Specific to RubyMotion:.dat*.repl_historybuild/*.bridgesupportbuild-iPhoneOS/build-iPhoneSimulator/## Specific to RubyMotion (use of CocoaPods):## We recommend against adding the Pods directory to your .gitignore. However# you should judge for yourself, the pros and cons are mentioned at:# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control## vendor/Pods/## Documentation cache and generated files:/.yardoc//_yardoc//doc//rdoc/## Environment normalization:/.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# Used by RuboCop. Remote config files pulled in from inherit_from directive.# .rubocop-https?--*

Templates from github/gitignore/Ruby.gitignore @356fd7b (2026-09-11) · CC0-1.0

Often used together

More template explanations