jdx/mise · error
could not fetch setup repository using local Git authenticat
Error message
could not fetch setup repository using local Git authentication
What it means
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.
Source
Thrown at src/system/remote_repository.rs:100
crate::git::sanitize_git_command(&mut command);
// No checkout: source templates and hooks are never evaluated locally.
command
.env("GIT_ALLOW_PROTOCOL", "https:ssh:file")
.args(["-c", &crate::git::github_credential_config("github.com")])
.args([
"-c",
&crate::git::github_credential_config("github.com:443"),
])
.args(["-c", "http.followRedirects=false"])
.args(["clone", "--no-checkout", "--no-local", "--"])
.arg(&origin)
.arg(&repo);
let output = tokio::process::Command::from(command)
.kill_on_drop(true)
.output()
.await?;
if !output.status.success() {
bail!("could not fetch setup repository using local Git authentication");
}
let revision = git_async(&repo, &["rev-parse", "HEAD"]).await?;
let branch = git_async(&repo, &["symbolic-ref", "HEAD"]).await?;
let bundle = directory.path().join("repository.bundle");
git_async(
&repo,
&[
"bundle",
"create",
bundle
.to_str()
.ok_or_else(|| eyre::eyre!("non-UTF8 staging path"))?,
"HEAD",
&branch,
],
)
.await?;
Ok(Self {View on GitHub (pinned to afd2eddd3a)
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
Example fix
# before $ git ls-remote https://github.com/owner/private.git fatal: Authentication failed # after $ gh auth login && git credential-helper refresh $ mise setup https://github.com/owner/private.git
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: verify the origin is reachable with local git auth // $ git ls-remote <origin> && echo ok
Try / catch
match Source::fetch(origin).await {
Ok(src) => proceed(src),
Err(e) if e.to_string().contains("local Git authentication") => {
// refresh credentials, check network, then retry once
refresh_git_credentials()?;
retry_fetch(origin)?;
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: Running fetch where `git fetch` against the origin fails: bad credentials, nonexistent repo, no network, or host key verification failure.
Common situations: Expired/insufficient token in the credential helper, SSH key not loaded into ssh-agent, VPN/firewall blocking the host, typo in the repository URL.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- cannot encode #{value.class} as JSON
- git command failed with {status}
- remote task path is not a regular file or directory: {}
- Got HTML instead of text from {}
- cannot encode #{value.class} as JSON
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/a59f6b3ac14de8fa.
Report an issue: GitHub.