MCPcopy Create free account
hub / github.com/cli/cli / LoginRefreshable

Method LoginRefreshable

internal/config/refreshable.go:146–154  ·  view source on GitHub ↗

LoginRefreshable stores a refreshable credential for the user, sets the git protocol, and activates the user. It mirrors Login: secure storage is preferred and the insecure configuration is used as a fallback, reported via the returned bool. Any non-expiring credential for the user is removed so it

(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool)

Source from the content-addressed store, hash-verified

144// runs under the cross-process refresh lock and reloads the configuration first, so it cannot interleave with a
145// concurrent configuration read-modify-write in another gh process.
146func (c *AuthConfig) LoginRefreshable(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool) (bool, error) {
147 var insecureStorageUsed bool
148 err := c.withFreshConfigForRefresh(func(lockErr error) error {
149 var err error
150 insecureStorageUsed, err = c.loginRefreshable(hostname, username, credential, gitProtocol, secureStorage)
151 return err
152 })
153 return insecureStorageUsed, err
154}
155
156func (c *AuthConfig) loginRefreshable(hostname, username string, credential gh.Credential, gitProtocol string, secureStorage bool) (bool, error) {
157 if hostname == "" || username == "" {

Callers

nothing calls this directly

Calls 2

loginRefreshableMethod · 0.95

Tested by

no test coverage detected