Skip to main content

install_git2_credentials

Function install_git2_credentials 

Source
pub fn install_git2_credentials(callbacks: &mut RemoteCallbacks<'_>, url: &str)
Expand description

Attach a credentials callback to libgit2 network operations against url.

Sources, in order: the credential this app cached locally for the host, then the user’s git credential helper (osxkeychain, Git Credential Manager, libsecret) — the same place system git would have looked — then an ssh-agent key for ssh remotes.

The helper fallback is the one that matters for skill sources. The keychain only holds hosts this app connected itself, which in practice means the backup remote; a skill living on a private GitLab or Gitea has no entry there and would still fail with a keychain-only callback.

Without any callback libgit2 reports “no callback set” (#379). A desktop launch hits that whenever the system-git attempt fails first: a GUI process has a leaner PATH than a shell and cannot prompt, so it falls through to libgit2 — which is why the same skill checks fine from the CLI.

Each source is offered once. libgit2 re-invokes this callback after every rejection, so a source that answers unconditionally would spin forever.