MB's avatar
Level 2

Forge, refusing to merge unrelated histories

Hi,

I got this error when trying to use Deploy Now in Laravel Forge:

 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

Have tried the following on the server (digitalocean), but the problem is the same:

git pull origin master --allow-unrelated-histories

I know what caused the problem, but not sure how to fix it. I'm a solo developer and used aws c9 for this project. I have since switched to Code. I tried to Clone the repo, but Github Desktop failed because of some errors in the .c9 config folder. Manually downloaded the files, removed the .c9 folder and pushed (-f) to github.

Any suggestions how to fix this?

, Kenneth

0 likes
5 replies
jbrooksuk's avatar
Level 1

Hi Kenneth,

If possible, it may be a good idea to delete the site and recreate it.

MB's avatar
Level 2

I would prefer not, but guess that's the most simple solution :)

Allex's avatar

Try your luck to talk to the customer service .. but they will answer 1 time each day. Is the worst customer service ever.

You should try another server manager. forget Forge.

GalahadXVI's avatar

I managed to fix this by running the following on the server (within the projects folder)

git fetch --all
git reset --hard origin/master
2 likes
andyknight's avatar

Just posting in case anyone else has this issue.

We had this error when trying to change deployment branch in Forge, from "laravel-11" to "master" in our case.

When running git branch -a, the master remote branch did not exist for some reason:

$ git branch -a
  laravel-11
* master
  remotes/origin/laravel-11

After some head scratching, we found that removing the origin and adding it back in, then fetch -a, fixed it:

$ git remote remove origin
$ git remote add origin [email protected]:your/repo
$ git fetch -a

After this, everything was normal.

Please or to participate in this conversation.