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

Alzaabi98's avatar

forge deployment failing

I have issue with forge deployment which I cant fix. When I load domain it is working fine but when i deploy any change I got this error :

  • branch master -> FETCH_HEAD error: Your local changes to the following files would be overwritten by merge: app/Category.php Please, commit your changes or stash them before you can merge. Aborting Updating b16e664..15a9a7d

Couldn't SSH Into Server?

Please make sure that the following SSH key is placed in both the /home/forge/.ssh/authorized_keys file and the /root/.ssh/authorized_keys file on your server.

but I dont have any issue with ssh.. I can login with ssh with no issues.. I can fix it by removing the domain and add it again.. but it will fail for next changes,,

any advice

0 likes
8 replies
bobbybouwmann's avatar
Level 88

Well the error says that you changed the Category.php file on the server. Never ever ever change files on your server when you have deploy script. It will break the flow. I guess you put your changes in your commits now anyway.

To solve this you need to revert the changes you made on the server. You can simply ssh into your server and go to your project. Then run the following command.

// Go back to the original branch since last deployment
git checkout .

You can now deploy again since you removed all the changes on the server.

Alzaabi98's avatar

bobbybouwmann ,

just to confirm.. do you mean that I should not change files in digotalocean.. and I should use only github via my mac??

regards Abdulaziz

bobbybouwmann's avatar

Yeah that is what I mean. Otherwise you have two versions running. Your local version that is connected to git and the one that is deployed based on git. If you change the one on the server git won't know what version to use.

alenabdula's avatar

Make changes locally on your Mac, push those changes to GitHub then have Forge pull in those changes. You should never SSH into your droplet and make manual changes to files that are part of your repository.

Hope that helps. Best, Alen.

Alzaabi98's avatar

Thank you all for your help .. One final question??

What about github ? Is it ok do changes there ??

bobbybouwmann's avatar

You can change it on Github, I believe it will create a separate commit for you. If that isn't the case you shouldn't be changing code there. You should run your code locally and see if everything works. If everything works you can push it to the server ;)

Please or to participate in this conversation.