Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I commit an empty .env file?

Tags:

git

dotenv

I have a .env file storing my database information, and I'm about to publish my project on GitHub. So, my question is, should I commit an empty .env file with the keys that I need, but without the values so other people can understand how to fulfill it (and may later add it to the .gitignore file)?

For example, if my .env file looks like this:

DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3

Should I commit it like this or just don't commit it at all?

DB_HOST=
DB_USER=
DB_PASS=

Thanks in advance.

like image 894
Doce Fernandes Avatar asked Sep 04 '26 22:09

Doce Fernandes


1 Answers

You should commit, but with another name, like .env.example. With that empty env, another team member can know how the env looks like and can fill in by themself.

like image 193
Chuong Tran Avatar answered Sep 06 '26 15:09

Chuong Tran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!