Updating credentials from the macOS Keychain

You'll need to update your saved credentials in the git-credential-osxkeychain helper if you change your username, password, or personal access token on GitHub.


当 Git 提示您输入密码时,请输入您的个人访问令牌 (PAT)。 基于密码的身份验证对 Git 已弃用,使用 PAT 更安全。 更多信息请参阅“创建个人访问令牌”。

Updating your credentials via Keychain Access

  1. Click on the Spotlight icon (magnifying glass) on the right side of the menu bar. Type Keychain access then press the Enter key to launch the app. Spotlight Search bar
  2. In Keychain Access, search for github.com.
  3. Find the "internet password" entry for github.com.
  4. Edit or delete the entry accordingly.

Deleting your credentials via the command line

Through the command line, you can use the credential helper directly to erase the keychain entry.

$ git credential-osxkeychain erase
> [Press Return]

If it's successful, nothing will print out. To test that it works, try and clone a private repository from GitHub. If you are prompted for a password, the keychain entry was deleted.

Further reading



所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。


或, 了解如何参与。