且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更新 GitHub 身份验证以在 macOS 上使用令牌(而不是密码)?

更新时间:2023-12-01 14:08:58

第一步

将其复制到您的终端 取消设置现有的 GitHub 登录凭据:

Copy this into your terminal to unset existing GitHub login credentials:

git config --global --unset credential.helper
git credential-osxkeychain erase
host=github.com
protocol=https

第 2 步

打开一个新的终端窗口,并设置提交的名称和电子邮件:

Open a new terminal window, and set the name and email for commits:

git config --global user.name "Your Name"
git config --global user.email you@example.com

步骤 3

运行一个 git pushgit clone 私有仓库,以便 GitHub 提示您输入用户名和密码.

Run a git push or git clone a private repository so GitHub prompts you to enter your username and password.

对于用户名,只需输入您的电子邮件.

For the username, simply enter your email.

将密码粘贴到您的令牌中(即从您 创建它 并粘贴它).

For the password paste in your token (i.e. copy the token from GitHub website where you created it and paste it in).