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

SimonHRD's avatar

.env file deleted when uploading in envoyer

Hi all

I user forge to maintain my server and envoyer to upload my laravel code to it. So when I upload my new code I commit my code and pull it to github and then upload to the server with envoyer. When I do this it always deletes my env, which I then past in again in forge environment site. How can I avoid this. Sure the .env file is in gitignore.

Thank you very much for your answer.

Best regards Simon

0 likes
6 replies
Tray2's avatar

Are you sure it's deleted? All file starting with a dot is hidden in *nix systems.

SimonHRD's avatar

Looks like it overwrites or deletes the .env file. Always when I deploy with envoyer it gives me a 500 server error and then I need to click in forge on the server->domain->environement and add my .env file again to it. And after the next deployment it is empty again

Tray2's avatar

Do you have a .env in your git repository?

If so remove it and try again.

I haven't used envoyer myself but there probably is a setting where you can specify which env to use.

SimonHRD's avatar

there is not a .env file in the git repository, just the .env.example file

SimonHRD's avatar
SimonHRD
OP
Best Answer
Level 2

The solution was to add the .env file not in forge. I added the .env file now in envoyer->servers->manage environment and it works fine

Please or to participate in this conversation.