Documentation
¶
Index ¶
- Constants
- Variables
- func GhCliToken() string
- func IsCredentialRequiredError(stderr, stdout string) bool
- func IterGitBasicAuth(ctx context.Context, url string) iter.Seq2[Credential, error]
- func SetSecretReader(fn func(ctx context.Context, name string) (string, error))
- func WithGitAuth(ctx context.Context, env map[string]string, url string, auth *BasicAuth) (map[string]string, error)
- type BasicAuth
- type Credential
- type GitResult
- type GitRunner
Constants ¶
const EnvTokenSource = "GITHUB_TOKEN/GH_TOKEN"
EnvTokenSource names the GITHUB_TOKEN or GH_TOKEN candidate in rejection lists and the stale token hint
Variables ¶
var ErrSecretReaderUnregistered = errors.New("gitcred: no secret reader registered, import pkg/provider")
ErrSecretReaderUnregistered is returned when a GitHub env token lookup runs before pkg/provider registered its reader
Functions ¶
func GhCliToken ¶
func GhCliToken() string
Token from the gh CLI keyring login with exported GitHub tokens hidden, empty when gh is absent or fails
func IsCredentialRequiredError ¶
Reports whether failed git output says the remote demands a credential rather than another failure
func IterGitBasicAuth ¶
Every credential the user owns for the URL host in precedence order without duplicates, looked up lazily
func SetSecretReader ¶
Installs the profile scoped secret lookup that GITHUB_TOKEN and GH_TOKEN resolve through
Types ¶
type BasicAuth ¶
type BasicAuth struct{ Username, Password string }
BasicAuth is the username and password pair git sends as an Authorization basic header
type Credential ¶
Credential is one owned credential with the source that supplied it