Trebejo.Git.Credentials (Trebejo v2.0.0)

Copy Markdown View Source

Git credential and SSH key configuration helpers.

Splits out the credential setup helpers from Trebejo.Git.Local so the local git operations module remains focused on clone/sync/branch workflows.

Not part of the public API — used only by Trebejo.Git.Local.

Note: Uses System.cmd/3 directly via Trebejo.Util.run_cmd_legacy/3 to avoid a circular dependency with Trebejo.Git.Local.run_git/1 (which is private).

Summary

Functions

Configures git's credential.helper to the given helper string.

Configures git's core.sshCommand to use the given SSH key path.

Functions

setup_credential_helper(credential_helper)

@spec setup_credential_helper(String.t()) :: :ok | {:error, term()}

Configures git's credential.helper to the given helper string.

setup_ssh_key(ssh_key)

@spec setup_ssh_key(Path.t()) :: :ok | {:error, term()}

Configures git's core.sshCommand to use the given SSH key path.

Returns :ok on success or {:error, reason} if the key doesn't exist or git config fails.