{"record":{"id":"62016ce10c6f2fef","repo":"gitbutlerapp/gitbutler","slug":"unable-to-determine-the-forge-for-this-project-is","errorCode":null,"errorMessage":"Unable to determine the forge for this project. Is target branch associated with a supported forge?","messagePattern":"Unable to determine the forge for this project\\. Is target branch associated with a supported forge\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/forge/review.rs","lineNumber":392,"sourceCode":"    .await\n}\n\n/// Make sure that the account that is about to be used in this repository's forge is correctly authenticated.\nasync fn ensure_forge_authentication(ctx: &mut Context) -> Result<(), anyhow::Error> {\n    let (storage, forge_repo_info, preferred_forge_user) = {\n        let remote_url = ctx\n            .project_meta()?\n            .remote_url_with_fallback(&*ctx.repo.get()?)?;\n        let forge_repo_info = but_forge::derive_forge_repo_info(&remote_url);\n        (\n            but_forge_storage::Controller::from_path(but_path::app_data_dir()?),\n            forge_repo_info,\n            ctx.legacy_project.preferred_forge_user.clone(),\n        )\n    };\n\n    let forge_repo_info = forge_repo_info.ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Unable to determine the forge for this project. Is target branch associated with a supported forge?\"\n        )\n    })?;\n\n    let account_validity =\n        but_forge::check_forge_account_is_valid(preferred_forge_user, &forge_repo_info, &storage)\n            .await?;\n\n    let forge_display_name = match forge_repo_info.forge {\n        but_forge::ForgeName::Azure => {\n            anyhow::bail!(\"Azure is unsupported at the minute. Sorry 😞.\");\n        }\n        but_forge::ForgeName::GitHub => \"GitHub\",\n        but_forge::ForgeName::GitLab => \"GitLab\",\n        but_forge::ForgeName::Bitbucket => \"Bitbucket\",\n    };\n\n    match account_validity {","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/forge/review.rs#L374-L410","documentation":"`ensure_forge_authentication` resolves the project's forge by deriving forge repo info from the target branch; the info is optional and `None` triggers this anyhow error. Auto-merge enabling, draftiness changes, and review creation all require a recognized forge, so the CLI stops here when the target branch is not associated with a supported forge.","triggerScenarios":"Calling `but review create`, `but forge enable-automerge`, or setting draftiness on a project whose target/push remote does not map to a supported forge (GitHub/GitLab etc.); missing or misconfigured push remote; target branch not set to a branch on a supported forge.","commonSituations":"Repo with only a generic or self-hosted remote unsupported by but_forge; target branch never pushed so no forge association exists; remote URL changed/renamed so forge detection fails; working in a project without a configured upstream.","solutions":["Set/verify the push remote URL points at a supported forge (github.com or gitlab.com style URL)","Push the target branch so it is associated with the forge, then retry","Check the project's target-branch assignment (`but target`) and reassign it to a branch on a supported forge","Confirm authentication exists for the forge account (`but auth`) — though the error here fires earlier, at forge detection"],"exampleFix":"// before: no forge-associated remote\nbut review create  // Error: Unable to determine the forge for this project...\n\n// after: point the remote at a supported forge and push the target\ngit remote set-url origin https://github.com/org/repo.git\ngit push -u origin my-branch\nbut review create","handlingStrategy":"validation","validationCode":"# ensure remote is a supported forge and target branch is pushed\nurl=$(git remote get-url --push origin)\necho \"$url\" | grep -Eq 'github\\.com|gitlab\\.com' || { echo \"unsupported forge remote: $url\"; exit 1; }\ngit ls-remote --heads origin \"$(but target --print 2>/dev/null || echo main)\" | grep -q . || { echo \"target branch not pushed\"; exit 1; }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Unable to determine the forge\") => {\n        eprintln!(\"Fix push remote / target branch so a supported forge is detected.\");\n    }\n    r => r?,\n}","preventionTips":["Point origin at a supported forge URL","Push the target branch before creating reviews or enabling auto-merge","Reassign the project target when remotes change","Authenticate the forge account with `but auth`"],"tags":["forge","github","gitlab","target-branch","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}