请使用个人访问令牌替代。(但是正在使用一个)

4
Username for 'https://github.com': username
Password for 'https://username@github.com': 
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/username/repo.git/'

尽管我使用了个人访问令牌,但我仍在收到此错误,并且已经正常工作了大约6个月,它没有到期日期。

但现在我正在尝试在我的VPS上拉取一些更改,出现了这个错误。

我已经创建了一个新的访问令牌,但仍然得到相同的错误。

我该如何解决这个问题?

2个回答

4

现在它说的是https://<my_github_token>@github.com的密码: - empflow

0

我在控制台或 Git Bash 上尝试使用以下命令时遇到了这个错误:

git push -u origin main

登录失败,请使用 ctrl+c 取消基本凭据提示。远程:2021 年 8 月 13 日后不再支持密码验证。请参阅https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls查看当前推荐的身份验证模式。致命错误:'https://github.com/JaseemKhan211/myNatours.git' 的身份验证失败。

很奇怪,因为今天我有很多时间来修复这个错误。要将代码推送到我的 GitHub 存储库中,我打开 Git Bash 并运行第一个命令。

git init

然后,所有命令逐个执行。

git status git add . git status git commit -m "first commit" git status git remote add origin https://github.com/JaseemKhan211/myNatours.git git push -u origin main
最后执行的命令导致一个窗口打开,提示填写用户名和密码。然而,在尝试填写这些信息时,控制台显示了一个错误。
我只需将Git升级到最新版本就解决了这个问题!
现在,您不再需要添加用户名/电子邮件和密码,而是使用浏览器登录。下面的图片是您必须更新Git才能看到新变化的新界面! enter image description here 如果您使用的是Windows,您可以简单地使用以下命令来更新Git:
git update-git-for-windows
然后更新Git,然后再次运行最后一个命令。

输入图像描述

成功登录后,我们收到了这条消息

输入图像描述


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接