github/gitignore · Ruby.gitignore
Ruby .gitignore 템플릿 해설
Ruby.gitignore가 gem 패키지, Bundler 설치 폴더, 테스트 결과, 문서 생성물을 무시하는 이유와 Gemfile.lock·.ruby-version 커밋 기준을 설명합니다.
Ruby.gitignore는 gem을 만들거나 Ruby 스크립트·애플리케이션을 개발하는 프로젝트용이다. 대부분의 규칙이 /로 시작해 저장소 루트에 고정되어 있어, 같은 이름의 하위 폴더를 실수로 무시하는 일이 적다.
Rails 애플리케이션이라면 이 템플릿보다 Rails 템플릿이 더 많은 경우를 다룬다. 둘을 함께 선택하면 겹치는 규칙은 중복 제거로 정리된다.
규칙별 해설
| 패턴 | 무엇을, 왜 무시하나 |
|---|---|
*.gem/pkg/ | gem 패키지gem build와 rake build가 만드는 패키지 파일이다. RubyGems에 게시하는 산출물이다. |
/.bundle//vendor/bundle/lib/bundler/man/ | Bundler.bundle/에는 로컬 Bundler 설정이, vendor/bundle에는 bundle install --path로 설치한 gem이 들어간다. 다른 컴퓨터에서 다시 설치할 수 있다. |
/coverage//spec/reports//spec/examples.txt/test/tmp//test/version_tmp/ | 테스트 결과SimpleCov 결과, RSpec 리포트, RSpec이 실패한 예제를 기억하는 examples.txt 같은 실행 결과다. |
/.yardoc//_yardoc//doc//rdoc/ | 문서 생성물YARD·RDoc이 만든 API 문서와 캐시다. 소스 주석에서 다시 만든다. |
/tmp/.byebug_history.repl_history*.rbc/.config/InstalledFiles | 임시·디버거 파일임시 폴더, byebug·REPL 기록, Rubinius 바이트코드, setup.rb 설치 기록이다. |
.rvmrc | 버전 관리자 설정RVM의 옛 프로젝트 설정 파일로, 셸 코드를 실행할 수 있어 공유를 피한다. 요즘은 .ruby-version을 주로 쓴다. |
실무에서 주의할 점
- 템플릿 주석대로 애플리케이션은
Gemfile.lock과.ruby-version을 커밋하고, 여러 환경에서 쓰일 라이브러리(gem)는 무시하는 경우가 있다. /doc/는 루트의doc폴더 전체를 무시한다. 손으로 쓴 문서를doc/에 둔다면 이 줄을 지우고/doc/api/처럼 생성 경로만 지정한다..env규칙은 이 템플릿에 주석으로만 있으므로 환경 변수 파일을 쓴다면 직접 추가한다.
원본 템플릿
Ruby.gitignore
*.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?--*
템플릿 출처: github/gitignore/Ruby.gitignore @356fd7b (2026-09-11) · CC0-1.0