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

Method LoginRefreshable

internal/config/refreshable.go:145–153  ·  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

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

Callers

nothing calls this directly

Calls 2

loginRefreshableMethod · 0.95

Tested by

no test coverage detected