情况是这样的,我直接用git clone
命令后,会提示让我输入GitHub账号密码,我输入后它还是显示克隆失败,并显示:
Cloning into 'folder_name'...
Username for 'https://github.com': user_name
Password for 'https://user_name@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/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/user_name/folder_name.git/'
也就是说现在不支持仅用账号密码来克隆GitHub项目了,解决方案是在输入密码时改为输入personal access token。获取personal access token的方式:
- 进入https://github.com/settings/personal-access-tokens/new
- 创建personal access token:选择项目范围接下来选择操作范围,我就选了能commit、pull request之类的功能,因为感觉也不需要别的功能。
- 生成personal access token后点击这个图标即可复制: