jdx/mise · error

repository origin must not contain credentials, query…

Error message

repository origin must not contain credentials, query parameters, or fragments

What it means

validate_origin rejects repository URLs that embed credentials (username/password), query parameters, or fragments. Remote onboarding must be able to clone via local Git authentication, so tokens in the URL, `?ref=...` style queries, and `#fragments` are all refused.

Solutions

  1. Remove username/password from the URL and rely on configured Git credentials (credential helper, SSH key, netrc).
  2. Remove query strings and fragments; pass the commit SHA via the revision parameter of install_at instead.
  3. For ssh:// URLs keep the username if needed (ssh scheme allows usernames); for https use a bare URL.
  4. Use an explicitly local path if you are working with a checked-out repository.

Example fix

// before
install_at("https://user:ghp_xxx@github.com/org/repo.git?ref=main", rev, ...).await?;
// after
install_at("https://github.com/org/repo.git", rev, ...).await?; // auth via git credential helper
Defensive patterns

Strategy: validation

Validate before calling

function urlHasSecrets(origin: string): boolean {
  try {
    const u = new URL(origin);
    return Boolean(u.password || (u.protocol !== "ssh:" && u.username) || u.search || u.hash);
  } catch { return false; }
}

Prevention

When it happens

Trigger: Calling Source::fetch or install_at with URLs like `https://user:token@host/repo.git`, `https://host/repo.git?ref=main`, or `https://host/repo.git#readme`, when the origin is not an explicitly local path. Note: for non-ssh schemes even a bare username triggers this.

Common situations: Pasting a PAT-bearing clone URL from a CI provider; appending `?ref=` to pin a branch (use the revision parameter instead); username in an https URL where only SSH URLs may carry one.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/80bf56f97be89a03. Report an issue: GitHub.

Appendix: source

Thrown at src/system/remote_repository.rs:71

        && origin.split_once("::").is_some_and(|(prefix, _)| {
            !prefix.is_empty() && !prefix.contains(['/', '\\', '[', ']', '@', ':'])
        })
    {
        bail!("Git remote helpers are not supported for remote onboarding");
    }
    if !explicit_local && origin.contains("://") {
        let url = url::Url::parse(origin).wrap_err("invalid repository URL")?;
        if !matches!(url.scheme(), "https" | "ssh" | "file") {
            bail!("remote bootstrap requires HTTPS, SSH, or a local path");
        }
    }
    if let Ok(url) = url::Url::parse(origin)
        && (url.password().is_some()
            || (url.scheme() != "ssh" && !url.username().is_empty())
            || url.query().is_some()
            || url.fragment().is_some())
    {
        bail!("repository origin must not contain credentials, query parameters, or fragments");
    }
    Ok(())
}

impl Source {
    pub(crate) async fn fetch(origin: String) -> Result<Self> {
        validate_origin(&origin)?;
        let directory = tempfile::tempdir()?;
        let repo = directory.path().join("repo");
        let mut command = Command::new("git");
        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"),

View on GitHub (pinned to 533346cc37)