Skip to main content

Git Credentials

Git Credential Policy

Stable

Keep native Git authoritative and optionally supply external HTTPS tokens to container pushes.

Command[tool.custy.git.credentials]

Category

Git Configuration

Quick Command

[tool.custy.git.credentials]

native firstexternal secretsDocker

Terminal
toml
[tool.custy.git.credentials]
mode = "native"
container_only = true
source_order = ["file", "environment"]
interactive_fallback = true
fail_non_interactive = true

[tool.custy.git.credentials.github]
enabled = false
username = "x-access-token"
token_file = "github.token"
token_env = "CUSTY_GITHUB_TOKEN"

[tool.custy.git.credentials.gitlab]
enabled = false
username = "oauth2"
token_file = "gitlab.token"
token_env = "CUSTY_GITLAB_TOKEN"

Policy Properties

Properties

PropertyTypeDescriptionDefaultRequired
modenative | autonative disables Custy's fallback. auto allows enabled sources after normal Git authentication.nativeNo
container_onlyBooleanRestrict managed fallback to a container so local credential-manager sessions remain unchanged.trueNo
source_orderString arraySearch missing sources in order. A malformed present source is an error, not a fallback condition.[file, environment]No
interactive_fallbackBooleanAllow Git's normal username/PAT prompt when the process has an interactive terminal and no managed token resolved.trueNo
fail_non_interactiveBooleanDisable terminal prompts when they cannot be answered, preventing CI and detached-container hangs.trueNo

Provider Properties

Properties

PropertyTypeDescriptionDefaultRequired
enabledBooleanOpt one supported provider into managed fallback.falseNo
usernameStringNon-secret HTTPS username. Defaults to x-access-token for GitHub and oauth2 for GitLab.Provider defaultNo
token_filePath stringExternal filename under the credential root, or an approved absolute path outside the target project.github.token / gitlab.tokenNo
token_envEnvironment nameVariable read only when environment is included in source_order and provider fallback is active.CUSTY_GITHUB_TOKEN / CUSTY_GITLAB_TOKENNo

Behavior matrix​

modecontainer_onlyLocal executionContainer execution
nativetrue or falseNative Git onlyNative Git only
autotrueNative Git onlyNative Git, then enabled fallback
autofalseNative Git, then enabled fallbackNative Git, then enabled fallback

External credential root​

RuntimeDefault
Windows%LOCALAPPDATA%\Custy\credentials
Linux$XDG_DATA_HOME/custy/credentials or ~/.local/share/custy/credentials
Docker/run/secrets/custy

CUSTY_CREDENTIALS_DIR overrides the root. Relative overrides resolve from the user home, not the project. Custy rejects paths within the target project.

Docker bind-mount mapping

On Windows CMD, this argument maps one persistent host directory to Custy's container credential root:

Terminal
bash
-v "%LOCALAPPDATA%Custycredentials:/run/secrets/custy"
Host pathContainer pathMeaning
%LOCALAPPDATA%\Custy\credentials\github.token/run/secrets/custy/github.tokenThe same mounted GitHub token file
%LOCALAPPDATA%\Custy\credentials\gitlab.token/run/secrets/custy/gitlab.tokenThe same mounted GitLab token file

Use a writable mount for configure credentials set. Add :ro for status, testing, and push after the file exists. Without this mount, /run/secrets/custy lives only in the container and is deleted with a --rm container.

Status interpretation​

ColumnMeaning
EnabledProvider policy stored in the project’s config.toml
Token fileAvailability and validation of the external file in this process
EnvironmentAvailability of the named token variable in this process

The last two columns describe alternative runtime sources. For example, Enabled: yes, Token file: valid, and Environment: missing is a healthy file-backed configuration.

Runtime source behavior​

Runtime stateBehavior
Valid file found firstUse the file; an absent environment variable is irrelevant
File missing, environment availableContinue to the environment source
No managed source, interactive TTY allowedGive native Git the terminal for a username/PAT or SSH prompt
No managed source, no usable TTYFail without waiting when fail_non_interactive = true
Malformed existing sourceStop with an actionable validation error

Resolution Rules

  1. Dry-run stops before token reads or remote contact.
  2. native mode stops at normal Git/SSH behavior.
  3. container_only = true stops managed fallback outside a container.
  4. Only exact supported HTTPS hosts are eligible.
  5. Git's existing helpers run before the per-command Custy helper.
  6. A missing file tries the next source; an invalid existing source stops.
  7. An interactive prompt may remain available. Custy gives Git direct terminal ownership so the prompt stays visible and usable.
  8. Non-interactive execution fails rather than hanging when the safeguard is enabled.

Continue