(1) Create a ".gitignore" file at the root level of your ruby project. 

(2) Edit the file and place the list of files and directories to ignore. E.g.

# Ignore bundler config.

# Ignore all logfiles and tempfiles.


# Ignore encrypted secrets key file.

If you are using IDE such as Rubymine, you can install the .ignore plugin and use it to automatically create the .gitignore file with the built-in template for Ruby.