git - 请改用个人访问 token 。 (但使用一个)

标签 git github personal-access-token

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/'

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

但现在我试图在我的 vps 上进行一些更改,但出现了这个错误。

我已经创建了一个新的访问 token ,但仍然出现相同的错误。

我该如何解决这个问题?

最佳答案

通过在推送或 pull 某些东西之前设置原始 url 来解决问题,就像这样:

~$ git remote set-url origin https://<githubtoken>@github.com/<username>/<repositoryname>.git

~$ git pull origin <branch>

正如此处所说 “Support for password authentication removed” for GitHub. How to Generate Personal Access Token?

关于git - 请改用个人访问 token 。 (但使用一个),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71517236/

相关文章:

reactjs - 在 username.github.io 部署一个 React 应用程序

git - 无法通过 Git Bash 克隆 git 存储库

git - 在 python 子进程中使用 git shortlog 获取每个文件的贡献者

c# - GIT 集成以在 Visual Studio 中显示方法历史记录

r - 从 github 私有(private)存储库安装包,无需个人访问 token

将 OAuth2 代码交换为访问 token 时,Azure AD 返回非 JWT token

git - git hooks如何在不同的操作系统上提供参数

iphone - 如何在 Xcode 中配置 Git 以使用 BitBucket

github - 如何使用相同的电子邮件地址创建一个新的GitHub帐户?