Kai Sheng Tung
Kai Sheng Tung

Reputation: 430

Deploy my React project from Github to Netlify

Basically I have a .env file in the project, however it will be ignored when I commit by git regarding to .gitignore, which also makes it kind of disappear when Netlify deploys this project from GitHub. Then I have to manually set my environment variables on Netlify.

Are there any other ways to do this, so I don't have manually set the environment variables in Netlify and it will read my .env file?

Upvotes: 1

Views: 286

Answers (1)

steadweb
steadweb

Reputation: 16541

Netlify supports environment variables, not through .env though. You'll need to configure these either through your dashboard or or in the netlify configuration file.

File

In the Netlify configuration file. File-based configuration allows you to set different environment variables for different deploy contexts. Variable values set in the configuration file will override values set in the UI.

Dashboard

In your site dashboard under Settings > Build & deploy > Environment > Environment variables. Variable values set under site settings will override the team-level settings.

Upvotes: 2

Related Questions