November 10, 2019
To help keep your application secure, secrets, API keys, or other sensitive values you don’t want somebody else getting their hands on, should never go into a file you plan to commit to source code. This is the reason why we add those values to a .env file and list that file in .gitignore so Git knows not to commit them. The problem with this is, outside of your local environment, the variables in those files are visible to no other application. This is what we want but it does mean that deploying with Netlify, or any other other deployment service, is going to fail.
Thankfully, adding environment variables to Netlify is incredibly easy but sometimes you just need someone to point you in the right direction. Start by logging into your Netlify account, navigate to the application you want to add variables to, then click on 'Settings' in the navbar.
From there, in the left panel, click on 'Build & Deploy', followed by 'Environment'.
All that's left to do now is add the variables. Click 'edit variables', add as many variables as you need, and hit save!
Couldn't be more simple!