Git 在Linux中要求验证身份

Git 在Linux中要求验证身份

问题描述

我正试图通过Linux终端将我的代码推送到GitHub,当我尝试这样做时,它要求我的用户名和密码,即使在提供了这些信息之后,仍然显示错误: remote: Support for password authentication was removed on August 13, 2021. 我在执行 git push 命令后遇到了这个错误。在我的Windows机器上没有这个问题(我知道如何在Windows上使用git命令),只有在Linux上才遇到这个问题。

完整的终端错误日志

pretham@pop-os:~/Documents/rust_apps/resource$ git push -u origin main
Username for 'https://github.com': PrethamMuthappa
Password for 'https://[email protected]': 
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/PrethamMuthappa/resource-monitor.git/'

解决方案

自2021年8月以来,命令行中的密码身份验证已被禁用。你需要使用另一种方法,如访问令牌或SSH(我推荐使用SSH)。

很可能你在Windows上设置了访问令牌或SSH,这就是为什么你没有看到这个问题。在Windows上也不支持密码身份验证。

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程