Preparing your App - Ignoring Files

When we set up a file, we’ll often have files and information that we’ll want to use and store in our local project folder but that we don’t necessarily want to have sitting on our live server or a GitHub repository.

For example, if we’re testing with a database locally, it’s probably dummy or junk data. We don’t want other people to see or access this.

When we work with APIs and other online services we’ll be given passwords and information specific to us to use. We don’t want that floating around on the web for others to use because it could introduce security concerns or other problems.

And this is a real problem. Recently Slack discovered that a tonne of developers had exposed their developer tokens publicly on GitHub and potentially their companies’ data too.

It’s good practice that we separate out the stuff. Thankfully we can keep it all in one folder, we just need to tell GitHub not to include it in anything that’s added to the repo.

We can do this by adding a .gitignore to hide our stuff.

To do this

  1. Open your repository in GitHub Desktop application

  2. Choose Repository in the menu, and then Repository Settings

  3. Choose the second tab which says: Ignored files

Then add the below and save:

# See https://help.github.com/articles/ignoring-files for more about ignoring files.

# Ignore bundler config.

/.bundle



# Ignore all logfiles and tempfiles.

/log/*.log

/tmp


# Ignore ruby-version

/.ruby-version

To learn more, visit https://help.github.com/articles/ignoring-files for more about ignoring files.

×

Subscribe

The latest tutorials sent straight to your inbox.