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

GrahamMorbyDev's avatar

Your local changes to the following files would be overwritten by merge

has anyone seen or fixed this error on forge deploy

 * branch            master     -> FETCH_HEAD
   64758ec..71b1817  master     -> origin/master
error: Your local changes to the following files would be overwritten by merge:
    .env
Please, commit your changes or stash them before you can merge.

all my .env files are og gitignore and its driving me nuts (as alot has today)

0 likes
4 replies
ejdelmonico's avatar

Are you commiting your .env file to the repo? If so, you are exposing yourself and someone probably already has any specific config info.

GrahamMorbyDev's avatar

Yah it was the fact I had the .env committing and not on git ignore. I just started my repo again and made sure the .env etc was on git ignore

cent040's avatar

Yes gitignore these files

.env & vendor folder

simple add these in gitignore.

For removing your current problem commit your server changes and push as well. After that ignore the files you can set .env file.

Regards Arfan

Please or to participate in this conversation.