Note: Updating credentials from the macOS Keychain only applies to users who manually configured a PAT using the osxkeychain
helper that is built-in to macOS.
We recommend you either configure SSH or upgrade to the Git Credential Manager Core (GCM Core) instead. GCM Core can manage authentication on your behalf (no more manual PATs) including 2FA (two-factor auth).
When Git prompts you for your password, enter your personal access token (PAT) instead. Password-based authentication for Git has been removed, and using a PAT is more secure. For more information, see "Creating a personal access token."
通过 Keychain Access 更新凭据
- 单击菜单栏右侧的 Spotlight 图标(放大镜)。 键入
Keychain access
,然后按 Enter 键启动应用程序。 - 在 Keychain Access 中,搜索 [hostname]。
- 查找
[hostname]
的“互联网密码”条目。 - 相应地编辑或删除该条目。
通过命令行删除凭据
通过命令行,您可以使用凭据小助手直接擦除密钥链条目。
$ git credential-osxkeychain erase
host=主机名
protocol=https
> [Press Return]
如果成功,则不会打印出任何内容。 要测试其是否有效,请尝试从 您的 GitHub Enterprise Server 实例 克隆私有仓库。 如果提示您输入密码,则该密钥链条目已删除。