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

eugenefvdm's avatar

Automated deployment of Github repo on Forge errs with "Untracked working tree file" for phpinfo() index file

I trying to create an automatic Forge deployment script which does the following:

  1. Contacts remote DNS name server to add an A record.
  2. Calls Forge's createSite
  3. Calls Forge's createMysqlUser
  4. Call's Forge's installGitRepository
  5. Updates the environment
  6. Updates the deployment script
  7. Deploys the site
  8. Installs Let's Encrypt

I'm using https://github.com/laravel/forge-sdk because it's got useful timeout and wait functions.

At point 4 installing Git repository it fails, after about 2 minutes (which is also my timeout).

None of the scripts needed either wait or timeouts but the Git one is proving really problematic.

The error appears to indicate an issue with the default index.php file that is created with every new forge site:

Cloning into 'test113.domain'...
Warning: Permanently added the RSA host key for IP address 'a.b.c.d' to the list of known hosts.
error: Untracked working tree file 'public/index.php' would be overwritten by merge.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Strangely from my localhost to the Forge server this doesn't fail, but from the Forge server to the Forge server I get this issue.

Here is the line that fails:

$result = $this->api->setTimeout(120)->installGitRepositoryOnSite($this->client['server_id'], $siteId, json_decode($payload, 1), true);

If I could get rid of the default phpinfo index.php file that could possibly help?

Any clues how to do this? Or advice on automated Github deployment using Forge?

0 likes
1 reply
srasch's avatar

Hey,

what do want to install? A "standard" PHP appication or an new Laravel application?

I did something familiar, but instead of creating a new site on an existing server, I'm always triggering a new server creation/installation like this:

  1. createServer
  2. createMysqlUser
  3. updateSite(because I don't want it as default)
  4. installGitRepositoryOnSite
  5. updateSiteEnvironmentFile (important BEFORE deploying the repo)
  6. getDeploymentScriptand updateSiteDeploymentScript
  7. enableQuickDeploy
  8. deploySite

If you need help in this specific case just use the support chat on Laravel Forge. James & the Team will help almost immediately. They are doing a great job!

Please or to participate in this conversation.