You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Laravel Forge manages auto-deploys of a Laravel app, on every push to the repository.
I've never had a problem, until we switched servers on DigitalOcean.
Following this I had to create a new server on Forge and link it to the previous server's repository.
The local code has remained the same, as has the remote code.
I just changed the server to Forge, and liked it to Bitbucket (as usual).
I have started to receive error like this:
on Feb 19 14:21:47 UTC 2023
* branch master -> FETCH_HEAD
35e743e..aa18902 master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
Please commit your changes or stash them before you merge.
Sun Feb 19 14:21:47 UTC 2023
From bitbucket.org:XXX/XXX-app * branch master -> FETCH_HEAD
error: cannot lock ref 'refs/remotes/origin/master': is at aa18902c3d1b2288a290f6c089be12e457205b77 but expected 35e743e53101820a74e4d903e12f14c481adc2d1
! 35e743e..aa18902 master -> origin/master (unable to update local ref)
I have try to reset my local git with:
git reset --hard
git clean -df
as suggested on Forge and inside various web blogs & articles without solutions.
Is there a way to align my local version, what is present on Bitbucket and the Forge server (on DIgitalOcean) ?
Many thanks for your help, very appreciated.
What command is executed when you get the errors you posted here? Is it a git pull or git fetch?
And where are the commands executed? On a clone of the repo on the Forge server? Or on your local repo? Or is one of them on the Forge server and the other one on your local repo?
The error in the first output you posted here indicates that there are changes in the working directory of that specific clone that have not been committed yet. You can either commit them (so that you don't lose them), or if you want to discard the changes that haven't been committed, run git reset --hard.
The second error is different. One possible cause for this error is having in the clone two branches with the same name and different capitalization. You can use the command git branch in the clone to see if there is perhaps a second branch named master with different capitalization.
If this is not the case, you can try removing the local ref refs/remotes/origin/master by running
git update-ref -d refs/remotes/origin/master
and then do a git pull or git fetch again. This will not delete anything on the Bitbucket repo, it will only remove the local ref, which should be fetched again once you run git fetch or git pull.
Dear @Theodora Boudale ,
many thanks for your reply, much appreciated!
I have try also this solution, but finally I have solved the problem stopping and restarting Forge Quick Deploy.
Probably, during the first boot you had saved two auto deploy settings and each push generated 2 deploy instances.