on my local server in my laravel app I have .env file.
to push changes to the server I use
git add .
git commit -m "something"
git push heroku master
but when I use heroku git:clone -a myapp
in the cloned app there is no .env file... there is only .env.development file.
Do I do something wrong?
The short answer is, “yes”. You should use your . gitignore file to ignore the . env file.
You shouldn't commit/include your . env file in your git repo because env stands for environment. You will different environment variables for your LOCAL, STAGING(development), PRODUCTION environments.
env files to version control (carefully) Many software projects require sensitive data which shouldn't be committed to version control. You don't want Bad Guys to read your usernames, passwords, API keys, etc.
Check your .gitignore
file if you have one there. If your git repo was set up for you automatically or imported from another project then it is likely that it is being ignored by default.
If it is in there then simply remove it to include your .env
file in your next commit.
Laravel, by default, ignores the .env
- this is very much intended, as your different environments should technically have, well, different env
files. It also helps you from not submitting credentials (such as for your database) into version control.
I would recommend you continue to follow this intended practice and look into using heroku config variables: https://devcenter.heroku.com/articles/config-vars
Open file text .gitignore
on root folder, git will skip file and folder in .gitignore
. You just delete all text. Then review git status.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With