How to hide .env file from Github

I am using dotenv for my rails project to store API keys. I have a dotenv gem in my gemfile generated by .env at the root of my application and I have the API keys listed there. However, when I click on github I notice that the .env file still exists. Did I miss a step? How to hide .env file from uploading to github.

Thank!

+3


source to share


2 answers


Create a file named .gitignore

in your project's root directory (it may already exist) and add .env

to your own line in the file.



Also, if you've already added it to your repository, you'll have to add the file in .gitignore

as above and then clear your Git cache. You can find information about this in fooobar.com/questions/405 / ... .

+3


source


You can exclude files from the repo with a .gitignore file: http://git-scm.com/docs/gitignore .



+5


source







All Articles