Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

timpackwood87's avatar

Deploying code from Github - how to deal with .env

Hi All

Any advice on how to handle the .env file when deploying to production server from github repro? It doesn't seem sensible to store the .env configuration file in the repro itself with all the sensitive passwords for DB etc in it.

How are others deploying code and then configuration files to production servers? Any and all advice welcome. In an automated way.

thanks

Tim

0 likes
2 replies
shez1983's avatar
shez1983
Best Answer
Level 23

well you normally ssh into the production server and create the .env file manually

ohffs's avatar

I use deployer. You can set it to deploy from a git repository and also upload a local file - eg, a production .env file. It comes with a laravel 'recipe' which does most of the work for you.

Please or to participate in this conversation.