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

Method removeCredentialForUser

internal/config/refreshable.go:529–535  ·  view source on GitHub ↗

removeCredentialForUser deletes every stored credential record for the user on the host, covering both the refreshable and the non-expiring forms in both the keyring and the insecure config, then writes the config. It intentionally leaves the active-user pointer and the rest of the host configuratio

(hostname, username string)

Source from the content-addressed store, hash-verified

527// called under the refresh lock). Each delete is best effort so a missing record or unavailable keyring does not stop
528// the others.
529func (c *AuthConfig) removeCredentialForUser(hostname, username string) error {
530 _ = keyring.Delete(refreshableServiceName(hostname), username)
531 _ = keyring.Delete(keyringServiceName(hostname), username)
532 _ = c.cfg.Remove(refreshablePath(hostname, username))
533 _ = c.cfg.Remove([]string{hostsKey, hostname, usersKey, username, oauthTokenKey})
534 return ghConfig.Write(c.cfg)
535}
536
537// persistRefreshedCredential writes a renewed refreshable credential back to the storage form it already lived in.
538// Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep

Callers 1

Calls 6

DeleteFunction · 0.92
refreshableServiceNameFunction · 0.85
refreshablePathFunction · 0.85
keyringServiceNameFunction · 0.70
RemoveMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected