如果使用用户名密码登录会出现这个提示:remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead
大概意思就是自从 21 年 8 月 13 后不再支持用户名密码的方式验证了,需要创建个人访问令牌(personal access token)
解决办法先在github上生成令牌,应用于所有仓库中:

点击settings

点击右边的developer settings

点击personal access tokens

点击右上角的generate new token

上图中expriation是过期时间,我这里选择不过期,下面的可选项我都选了,可以根据实际情况决定选哪些

点击提交之后得到这样一串东西,一定要保存好,以后就看不到了。
然后在使用git时加入这串key就可以了
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
<your_token>就是刚才生成的令牌
<USERNAME>是你的用户名
<REPO>是你的项目名称