{"record":{"id":"a59f6b3ac14de8fa","repo":"jdx/mise","slug":"could-not-fetch-setup-repository-using-local-git-a","errorCode":null,"errorMessage":"could not fetch setup repository using local Git authentication","messagePattern":"could not fetch setup repository using local Git authentication","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":100,"sourceCode":"        crate::git::sanitize_git_command(&mut command);\n        // No checkout: source templates and hooks are never evaluated locally.\n        command\n            .env(\"GIT_ALLOW_PROTOCOL\", \"https:ssh:file\")\n            .args([\"-c\", &crate::git::github_credential_config(\"github.com\")])\n            .args([\n                \"-c\",\n                &crate::git::github_credential_config(\"github.com:443\"),\n            ])\n            .args([\"-c\", \"http.followRedirects=false\"])\n            .args([\"clone\", \"--no-checkout\", \"--no-local\", \"--\"])\n            .arg(&origin)\n            .arg(&repo);\n        let output = tokio::process::Command::from(command)\n            .kill_on_drop(true)\n            .output()\n            .await?;\n        if !output.status.success() {\n            bail!(\"could not fetch setup repository using local Git authentication\");\n        }\n        let revision = git_async(&repo, &[\"rev-parse\", \"HEAD\"]).await?;\n        let branch = git_async(&repo, &[\"symbolic-ref\", \"HEAD\"]).await?;\n        let bundle = directory.path().join(\"repository.bundle\");\n        git_async(\n            &repo,\n            &[\n                \"bundle\",\n                \"create\",\n                bundle\n                    .to_str()\n                    .ok_or_else(|| eyre::eyre!(\"non-UTF8 staging path\"))?,\n                \"HEAD\",\n                &branch,\n            ],\n        )\n        .await?;\n        Ok(Self {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L82-L118","documentation":"Source::fetch shells out to git (with local git authentication, i.e. the user's stored credentials/ssh agent) to fetch the setup repository. If that git invocation exits nonzero, mise cannot obtain the repository and throws this error.","triggerScenarios":"Running fetch where `git fetch` against the origin fails: bad credentials, nonexistent repo, no network, or host key verification failure.","commonSituations":"Expired/insufficient token in the credential helper, SSH key not loaded into ssh-agent, VPN/firewall blocking the host, typo in the repository URL.","solutions":["Run `git ls-remote <origin>` manually to reproduce the auth/network failure","Refresh git credentials (gh auth login, credential helper re-auth, ssh-add)","Verify the repository exists and you have read access"],"exampleFix":"# before\n$ git ls-remote https://github.com/owner/private.git\nfatal: Authentication failed\n# after\n$ gh auth login && git credential-helper refresh\n$ mise setup https://github.com/owner/private.git","handlingStrategy":"try-catch","validationCode":"// preflight: verify the origin is reachable with local git auth\n// $ git ls-remote <origin> && echo ok","typeGuard":null,"tryCatchPattern":"match Source::fetch(origin).await {\n    Ok(src) => proceed(src),\n    Err(e) if e.to_string().contains(\"local Git authentication\") => {\n        // refresh credentials, check network, then retry once\n        refresh_git_credentials()?;\n        retry_fetch(origin)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run `git ls-remote <origin>` before invoking fetch","Keep ssh-agent loaded and credential helpers fresh (gh auth login)","Check VPN/network reachability of the git host"],"tags":["git","network","authentication"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}