问题原因:2021年github不再接受账户密码验证,必须使用token
解决方式:
- 创建token
Settings(设置)-Developer settings(最下面)->(左边)Personal access tokens->Generate new token->勾选范围(可以全选)->Generate token 按钮,完成创建。
注意:创建完及时进行复制保存 - 使用token
原本命令
更改后git remote add origin https://github.com/jiang-gy/XXX.git
若显示git remote add origin https://<token>@github.com/jiang-gy/XXX.git
remote origin already exists
,则运行以下命令git remote rm origin
参考
- https://blog.csdn.net/weixin_45844049/article/details/123733065