github push 代码出现fatal: Authentication failed for ‘https://github.com/xxx/xxx.git/'

问题描述
想从服务器上push代码到github,遇见fatal: Authentication failed for 的问题,弄了很久终于解决。

我是第一次使用github上传代码,在git pull origin master步骤中出现身份验证通过的现象。

可能出现的解决方案:
网上查了一圈,大多都是说,这两个参数应该和github账户匹配,即username应该是github账户名字,email是github绑定邮箱。

git config --global user.name [username]
git config --global user.email [email]

我改正后依旧不行。始终出现以下问题。

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/xxx/xxx.git/'

在网上搜了一堆解决方法,都不能解决后。

定睛一看

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.


原来人家已经提示了问题所在,而我一度以为是账户密码的问题,好傻缺,大概意思就是2021.8月份开始远程登录不在支持使用账户密码的方式。。。。。。。。发现这个问题后马上找到了解决方法。

##############真正的解决方法############

解决方法

按照里面提示,将原来的

git remote add origin https://github.com/xxx/xxx.git

指令换成

git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git

的格式后成功解决这个问题。

 

posted @ 2022-08-01 18:37  民宿  阅读(1612)  评论(0编辑  收藏  举报