赞
踩
% git clone https://github.com/.../....git
Cloning into '...'...
Username for 'https://github.com': 3427870036@qq.com
Password for 'https://....com@github.com':
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/.../....git/'
原因:是因 github 在 2020 年 7 月,宣布要求对所有经过身份验证的 Git 操作使用基于令牌的身份验证(例如,个人访问 GitHub 应用程序安装令牌)。从 2021年8月13 日开始,将在 GitHub.com 上对 Git 操作进行身份验证时不再接受帐户密码。
官方提供的解决教程:点击查看
不知道怎么选可以选择永不过期…
不知道怎么选可以选择就全选吧…
// <your_token>:包括<>在内的全部字符替换成你的token
// <USERNAME>:包括<>在内的全部字符替换成你的username
// <REPO>:包括<>在内的全部字符替换成你要访问的仓库名称
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
git push origin main
1、若是新的仓库,在密码处输入刚才的令牌代替原来的密码即可。如下:
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
2、若是已有的仓库,需要使用凭据小助手擦除旧的密钥链条目。
$ git credential-osxkeychain erase
host=github.com
protocol=https
> [Press Return]
找到 Keychain access。
在 Keychain Access 中,搜索 github.com。
查找 github.com 的“互联网密码”条目。
相应地编辑(把密码改为创建的令牌)。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。