An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(git): use exact refspec in ls-remote to avoid matching similarly named branches (e.g., changeset-release/main). Use refs/heads/<branch> or provider-specific PR refs.
Manthan Mallikarjun08e4086bb967
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex bc5fab30c6..efece13dfc 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -1421,6 +1421,19 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueif ($this->pull_request_id !== 0) {$local_branch = "pull/{$this->pull_request_id}/head";}+ // Build an exact refspec for ls-remote so we don't match similarly named branches (e.g., changeset-release/main)+ if ($this->pull_request_id === 0) {+ $lsRemoteRef = "refs/heads/{$local_branch}";+ } else {+ if ($this->git_type === 'github' || $this->git_type === 'gitea') {+ $lsRemoteRef = "refs/pull/{$this->pull_request_id}/head";+ } elseif ($this->git_type === 'gitlab') {+ $lsRemoteRef = "refs/merge-requests/{$this->pull_request_id}/head";+ } else {+ // Fallback to the original value if provider-specific ref is unknown+ $lsRemoteRef = $local_branch;+ }+ }$private_key = data_get($this->application, 'private_key.private_key');if ($private_key) {$private_key = base64_encode($private_key);@@ -1435,7 +1448,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueexecuteInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'),],[- executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$local_branch}"),+ executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$lsRemoteRef}"),'hidden' => true,'save' => 'git_commit_sha',]@@ -1443,7 +1456,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue} else {$this->execute_remote_command([- executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$local_branch}"),+ executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$lsRemoteRef}"),'hidden' => true,'save' => 'git_commit_sha',],