eugenevdm
2 months ago
261
1
Forge

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

Posted 2 months ago by eugenevdm

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?

Please sign in or create an account to participate in this conversation.