GitHub 在 2021 年 8 月,取消了对 HTTPS URL 密码身份验证支持。如果尝试使用 HTTPS URL Clone 仓库并使用密码进行身份验证,将会收到 Support for password authentication was removed on August 13, 2021
的错误提示
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/collabnix/reponew'
使用 Person Access Token(PAT)
1. 创建 PAT
登录 Github 账户,前往 Settings
Settings
2. 生成新 Token
选择 Develper settings,然后点击 Personal access tokens
Personal access tokens
点击 Tokens(classic),然后点击 Generate new token 按钮,开始创建 token,并选择对应的 scopes,如果需要 clone 仓库,需要勾选 "repo"
Generate new token
3. 复制 token 到粘贴板
当 clone 仓库提示输入密码时,粘贴 token 到光标上,指令例子如下:
git clone https://github.com/xxxxx/xxx.git
网友评论