缠丝猫 发表于 2024-12-12 10:48:22

git clone报错:remote: Support for password authentication was removed

报错内容:

% 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 操作进行身份验证时不再接受帐户暗码。
官方提供的解决教程:点击查看
第一步:点击Settings

https://i-blog.csdnimg.cn/blog_migrate/18a26bae993d21bf74468a8440b5b3cf.png#pic_center
第二步:点击Developer settings

https://i-blog.csdnimg.cn/blog_migrate/134db4449bb8c7934cc663c88c5bb3f3.png#pic_center
第三步:点击Personal access tokens

https://i-blog.csdnimg.cn/blog_migrate/50be1d35b5a2ba1b8697322f0ced84d0.png#pic_center
第四步:点击Generate new token

https://i-blog.csdnimg.cn/blog_migrate/65acc3bf49209b91079c02c2a56cd594.png#pic_center
第五步:给token起一个形貌名字(随便起)

https://i-blog.csdnimg.cn/blog_migrate/7a79917b03ea8d5d698822b167badf05.png#pic_center
第六步:设置token多久后过期,有效期本身选择。

不知道怎么选可以选择永不外期…
https://i-blog.csdnimg.cn/blog_migrate/bd60a7ea7a8f984e00e37bf1fc926dac.png#pic_center
第七步:选择要授予此令牌的作用域或权限。 要使用令牌从下令行访问仓库,请选择 repo(仓库)。

不知道怎么选可以选择就全选吧…
https://i-blog.csdnimg.cn/blog_migrate/bd60a7ea7a8f984e00e37bf1fc926dac.png#pic_center
第八步:点击Generate token,生成一个token

https://i-blog.csdnimg.cn/blog_migrate/16669a9973de314dede89d31ad57d2c5.png#pic_center
第九步:单击 将令牌复制到剪贴板。关闭页面后不能再出现,除非重新生成!

https://i-blog.csdnimg.cn/blog_migrate/197f0196c2ba07fdb3a7ab043fccfabb.png#pic_center
第十步:设置token,使用

// <your_token>:包括<>在内的全部字符替换成你的token
// <USERNAME>:包括<>在内的全部字符替换成你的username
// <REPO>:包括<>在内的全部字符替换成你要访问的仓库名称
git remote set-url originhttps://<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
>
MAC 用户需要在钥匙串内里清除:

找到 Keychain access。
在 Keychain Access 中,搜索 github.com。
查找 github.com 的“互联网暗码”条目。
相应地编辑(把暗码改为创建的令牌)。
https://i-blog.csdnimg.cn/blog_migrate/546c33c3b3b281b29a8739225dda56d8.png#pic_center

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: git clone报错:remote: Support for password authentication was removed