Skip to main content

git_ssh_credentials

Function git_ssh_credentials 

Source
pub fn git_ssh_credentials(
    _url: &str,
    username_from_url: Option<&str>,
    allowed_types: CredentialType,
) -> Result<Cred, Error>
Expand description

Git credential callback for git2 — handles SSH and HTTPS authentication. Used by sources/, modules/, and daemon/ for all git operations.

Tries in order:

  1. SSH agent (for SSH URLs)
  2. SSH key files: ~/.ssh/id_ed25519, ~/.ssh/id_rsa (for SSH URLs)
  3. Git credential helper / GIT_ASKPASS (for HTTPS URLs)
  4. Default system credentials