目录

问题

解决

步骤一、

步骤二、

步骤三、

​步骤四、

​步骤五、

步骤六、


问题

今天创建一个 github 新仓库,首次上传本地代码时,遇到了一个报错。但是,之前这样操作肯定是没有问题的,毕竟我可以保证用户名和密码都是正确的。目测判断是认证相关问题,具体报错信息如下:

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/liuzhenyilang/rtctest.git/'

报错截图如下:

解决

通过搜索相关资料发现,原来是 github 的认证策略发生了改变,在 2021年8月13日 的时候,用户名加密码的认证方式被去掉了,换成了 个人令牌(Personal Access Token)的校验方式。我说呢,怎么在我百分之百确认用户名和密码没有输入错误的情况下,怎么还是一而再再而三的提示我认证有问题。

好了,知道原因了,那就想办法解决吧。

if (英文好的小伙伴)

可以参考链接:About remote repositories - GitHub Docs

else

看文章后续内容;

解决上述问题的基本思想就是先创建一个个人令牌,然后在上传代码的时候用上它就搞定了。

其实,英文链接中讲的内容也是这个意思:

接下来,我们介绍一下具体的操作步骤。

步骤一、

首先,点击 github 仓库右上角的个人头像,选择“设置”(Settings),具体如下图所示:

步骤二、

在“设置”页面左侧的底部选择“开发者设置”(Developer setttings),如下图所示:

步骤三、

个人访问令牌选择“经典令牌”(Tokens(classic)),如下图所示:

然后,点击“生成新的访问令牌”按钮,再选择“生成经典令牌”,如下图所示:

步骤四、

先填写生成令牌的目的,然后选择令牌的有效期,最后勾选令牌的作用范围。

步骤五、

拿到个人令牌token后,如果是首次 clone 工程代码,可以使用如下命令:

git clone https://<token>@github.com/<*>/<*>.git

如果是在已经存在的工程中操作,可以先执行如下命令,再执行其他操作就没有问题了。

git remote set-url origin https://<token>@github.com/<*>/<*>.git

步骤六、

我们遇到的情况就执行上面的第二条命令,然后再上传代码,报错消息,具体输出结果如下:

Counting objects: 160, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (157/157), done.

Writing objects: 100% (160/160), 1.76 MiB | 336.00 KiB/s, done.

Total 160 (delta 20), reused 0 (delta 0)

remote: Resolving deltas: 100% (20/20), done.

To https://github.com/liuzhenyilang/rtctest.git

* [new branch]      main -> main

Branch 'main' set up to track remote branch 'main' from 'origin'.

过程截图如下:

好了,至此,文章开头提到的问题就解决了。如果你也遇到了类似问题,不妨试试这个方法!Good Luck!


作者简介:

解决报错:fatal: Authentication failed for ‘https://github.com/*/*.git/‘相关推荐

  1. Git报错:fatal: Authentication failed for ‘https://gitee.com/.......‘

    提交代码到码云,Git报错如下: Gavin: Incorrect username or password (access token) fatal: Authentication failed f ...

  2. Git报错:fatal: Authentication failed for https://gitee.com

    这句话的意思是:认证失败 原因:用户名或密码错误 解决方法:重置用户名密码 git config --system --unset credential.helper 之后再提交即可

  3. Mac 升级后git pull 报错fatal: Authentication failed for 解决办法

    转载:Mac 升级后git pl 报错fatal: Authentication failed for 解决办法 - 简书 git pull,,,报错如下: cat .git/config git r ...

  4. 解决git报错fatal: Authentication failed for ‘http://10.10.208.29/root/xmh.git/‘

    今天准备在git push代码的时候,突然报错fatal: Authentication failed for 'http://10.10.208.29/root/xmh.git/' 然后尝试了git ...

  5. 解决:fatal: Authentication failed for ‘https://github.com/xxxx/git-demo.git/‘

    文章目录 报错 原因 解决步骤 生成令牌 报错 git执行语句:git push git-demo master 报错:fatal: Authentication failed for 'https: ...

  6. git配置报错fatal: Authentication failed for ‘‘问题解决

    git配置报错fatal: Authentication failed for ''问题解决 参考文章: (1)git配置报错fatal: Authentication failed for ''问题 ...

  7. git拉取代码报错fatal Authentication failed for ‘httpxxxx.git‘‘解决方案

    git拉取代码报错fatal: Authentication failed for 'http:xxxx.git''解决方案 1.需求背景 最近由于自己的主机出问题了,所以换了一台主机,然后在换的主机 ...

  8. 阿里云Code(code.aliyun)提交代码时报错fatal: Authentication failed for‘https://code.aliyun.com/...‘身份验证失败

    阿里云Code(code.aliyun)提交代码时报错fatal: Authentication failed for'https://code.aliyun.com/-'身份验证失败,是因为阿里云登 ...

  9. 【报错fatal: unable to access ‘https://github解决办法】

    报错fatal: unable to access 'https://github解决办法 方法一:修改host文件 方法二:把命令行里的http改为git重新执行 方法一:修改host文件 把140 ...

最新文章

  1. Vue的模板语法学习
  2. Oracle E-Business Suite Maintenance Guide Release 12.2(Patching Utilities)
  3. python算法与数据结构-快速排序算法(36)
  4. 前端真的能做到彻底权限控制吗?
  5. 使用dbutils对表进行增删改查
  6. JUnit与TestNG:您应该选择哪种测试框架?
  7. 使用AspectJ审计Spring MVC Webapp。 第1部分
  8. Pycharm2019版中打开.md .st文件出现卡死情况怎么办?
  9. 阶乘末尾蓝桥杯java_Java实现第九届蓝桥杯阶乘位数
  10. leetcode 13 13. 罗马数字转整数 (python)
  11. VMware centos7镜像安装详细步骤
  12. sumifs 汇总_空标准单元格的SUMIFS公式
  13. 上海人设提示访问接口出错
  14. 搭建网站是进行创业的第一步
  15. 二分区间的左右边界-Leetcode 33题
  16. 【Linux】IFS是个什么鬼
  17. 数据可视化之matplotlib实战:plt.pie() 绘制分裂式饼图
  18. getaddrinfo神秘面纱
  19. 每日案例(第二期):智慧能源领域知识图谱实践案例速读
  20. 试用了hipihi首批账号

热门文章

  1. Tips Tricks
  2. 超个性鼠标设计桌面图标
  3. WBTCITRIX上实现安装打印机的几种方法
  4. 最右android工资,Android逆向之旅—最右App的签名算法解析(ARM指令学习不舍篇)
  5. 漫步数理统计二十七——t与F分布
  6. 组合数——Lucas 基础学习整理【陆续更新】
  7. Ubuntu14.04下wine国际版QQ
  8. 【详解】Transfer learning迁移学习 附代码
  9. 实现重点讲解部分局部放大,其余变暗效果
  10. 批判性思维训练|读美团四大名著之《学会提问》