当 Git 提示您输入密码时，请输入您的个人访问令牌 (PAT)。 基于密码的身份验证对 Git 已弃用，使用 PAT 更安全。 更多信息请参阅“创建个人访问令牌”。
- Click on the Spotlight icon (magnifying glass) on the right side of the menu bar. Type
Keychain accessthen press the Enter key to launch the app.
- In Keychain Access, search for github.com.
- Find the "internet password" entry for
- Edit or delete the entry accordingly.
Through the command line, you can use the credential helper directly to erase the keychain entry.
$ git credential-osxkeychain erase host=github.com protocol=https > [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.