{"record":{"id":"89f1693e1fe70590","repo":"coollabsio/coolify","slug":"your-deploy-key-does-not-have-access-to-the-reposi","errorCode":null,"errorMessage":"Your deploy key does not have access to the repository. Please check your deploy key and try again.","messagePattern":"Your deploy key does not have access to the repository\\. Please check your deploy key and try again\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Models/Application.php","lineNumber":2170,"sourceCode":"                \"git sparse-checkout set {$fileList->implode(' ')}\",\n                'git read-tree -mu HEAD',\n                \"cat .$workdir$composeFile\",\n            ]);\n        }\n        try {\n            $composeFileContent = instant_remote_process($commands, $this->destination->server);\n        } catch (\\Exception $e) {\n            // Restore original values on failure only\n            $this->docker_compose_location = $initialDockerComposeLocation;\n            $this->base_directory = $initialBaseDirectory;\n            $this->save();\n\n            if (str($e->getMessage())->contains('No such file')) {\n                throw new RuntimeException(\"Docker Compose file not found at: $workdir$composeFile (branch: {$this->git_branch})<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.\");\n            }\n            if (str($e->getMessage())->contains('fatal: repository') && str($e->getMessage())->contains('does not exist')) {\n                if ($this->deploymentType() === 'deploy_key') {\n                    throw new RuntimeException('Your deploy key does not have access to the repository. Please check your deploy key and try again.');\n                }\n                throw new RuntimeException('Repository does not exist. Please check your repository URL and try again.');\n            }\n            throw new RuntimeException('Failed to read the Docker Compose file from the repository.');\n        } finally {\n            // Cleanup only - restoration happens in catch block\n            $commands = collect([\n                \"rm -rf /tmp/{$uuid}\",\n            ]);\n            instant_remote_process($commands, $this->destination->server, false);\n        }\n        if ($composeFileContent) {\n            $this->docker_compose_raw = $composeFileContent;\n            $this->save();\n            $parsedServices = $this->parse();\n            if ($this->docker_compose_domains) {\n                $this->reconcileDockerComposeDomains($parsedServices);\n            }","sourceCodeStart":2152,"sourceCodeEnd":2188,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Models/Application.php#L2152-L2188","documentation":"During the same clone-and-read flow, Git's stderr contains 'fatal: repository ... does not exist' while the application authenticates with a deploy key. Git hosts (notably GitHub) return this identical message for private repositories the credential cannot read, so Coolify reports it as a deploy-key access problem: the attached key is not registered on that repository (or lacks read access).","triggerScenarios":"Deploy key's public half never added to the repo, added to a different repo, or deleted; wrong PrivateKey attached to the application; deploy key regenerated so the public half on the repo no longer matches; repo made private after the key was set up.","commonSituations":"Copying a key configured for repo A onto application B; rotating keys server-side but not on the Git host; org-level policies removing deploy keys.","solutions":["Add the private key's public half to the repository under Settings → Deploy keys (read-only is sufficient for clone/pull).","Confirm the application has the correct PrivateKey attached (compare fingerprints if unsure).","If the key was rotated, update the repo's deploy key to the new public key.","Verify the repository URL is correct — a genuinely wrong URL yields this same error under deploy-key auth."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the deploy key can read the repo before deploying\n$status = $application->getGitRemoteStatus(deployment_uuid: $uuid);\nif (! $status['is_accessible'] && $application->deploymentType() === 'deploy_key') { /* instruct: add public key to repo deploy keys */ }","typeGuard":null,"tryCatchPattern":"catch (RuntimeException $e) { if (str_contains($e->getMessage(), 'deploy key does not have access')) { stop with instructions to register the key's public half on the repository; retry only after the key is added. } else { throw $e; } }","preventionTips":["Automate adding the public key to the repo when creating deploy-key applications.","After key rotation, update repo deploy keys in the same operation.","Prefer one key per application to make 'wrong repo' mismatches obvious."],"tags":["git","deploy-key","authentication","coolify"],"backgroundTag":"git-auth-failed","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}