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

Alzaabi98's avatar

failed deployment using Forge.. "your local changes will be overwritten "

Can someone help .. i am getting this error from time to time in Forge. The only solution is i remove repository and start from scratch.. the issues that it comes after few day.s.. what i am doing wrong to cause this error when I deploy and how can I solve it.


Mon Sep 19 20:29:14 GST 2016
From github.com:
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    composer.json
    composer.lock
Please, commit your changes or stash them before you can merge.
Aborting
Updating 7ed39dd..e63d3cc
0 likes
10 replies
bobbybouwmann's avatar

It looks like you are running composer update or composer require on your server. You should never do that. Always change stuff locally and commit those changes to your server.

bobbybouwmann's avatar
Level 88

To solve this you can simply ssh into your server and in the project directory run this

git checkout .

It will reset the branch to the original commits.

18 likes
Alzaabi98's avatar

But how can I do composer if I need to add something in the project.. I was having issue with facker and When I run


composer require fzaninotto/faker

it worked.. Please explain to me how I can run composer libraries if need to do that.. this point is still not clear to me...

Alzaabi98's avatar

bobbybouwmann

any advice about the my question above.. to avoid such issue..

mbarb's avatar

I am having the same issue as Alzaabi98. if I run **composer require fzaninotto/faker ** for example on my local homestead and commit - push the changes to the server the server response with the same error. I have to run the same command on the server to get the package installed.

aurawindsurfing's avatar

@bobbybouwmann

should

git checkout .

be part of normal deployment script on forge then? I seem to run into this issue more often lately.

Thanks!

bobbybouwmann's avatar

@aurawindsurfing You shouldn't have these issues if you don't change files directly on the server. A deployment should always be done on forge by pulling the code and that's it. If you update files on your own git gets out of sync.

It can also happen that you have a log or cache file in source control which being updated after deployment or when running your application and therefore git gets out of sync.

2 likes
ibasestudio's avatar

Send command rm -fr package-lock.json, and restart deploy and it will work

Please or to participate in this conversation.