我使用用户名密码来推送我的代码。它工作了几个月,但突然我不能这样做,并得到这个错误:

Username for 'https://github.com': shreyas-jadhav
Password for 'https://shreyas-jadhav@github.com':
remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.

请注意,这个链接没有任何帮助。即使使用生成的令牌也无济于事。

主持人注:这是GitHub计划的一部分,很快将是永久的服务变化


当前回答

从GitHub的开发者设置中生成一个新的令牌 更新远程URL: git remote set-url origin https://<token>@github.com/<Git_URL> 拉: git拉https://<token>@<Git_URL>.git

这样就可以开始了。

其他回答

从GitHub的开发者设置中生成一个新的令牌 更新远程URL: git remote set-url origin https://<token>@github.com/<Git_URL> 拉: git拉https://<token>@<Git_URL>.git

这样就可以开始了。

如果你使用的是HTTPS版本而不是SSH版本,那么这个错误将会出现,因为GitHub正在删除HTTPS方法来维护存储库。

生成一个SSH密钥,如果你还没有SSH -keygen,并继续按Enter直到结束 猫~ / . ssh / id_rsa。Pub -复制结果 访问https://github.com/settings/keys 单击“新建SSH密钥”,将密钥粘贴到文本框中。标题可以是任何你想要的 CD <到项目的目录> Git remote set-url origin git@github.com:<username-here>/<repository-name-here>.git

你可以开始了!

我试了所有的方法,最后都奏效了。由于这个错误,我无法在我的存储库中推送,所以请至少尝试一次!

_____________________________ 生成个人访问令牌:

点击这里并生成一个个人访问令牌。这太简单了。 https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token 现在只需在PAT的帮助下按一下,而不是密码和用户名___________________ 要将更改推送到存储库: git push https://[个人访问令牌]@github.com/[用户名]/[存储库名称].git

如果您使用的是HTTPS

按照文档中的指示在令牌设置中生成一个令牌 如果存储库已经存在,则必须按照以下格式更改远程URL: https://<username>:<token>@github.com/<repository_url> Git远程删除原点 git remote add origin https://<USERNAME>:<TOKEN>@<GIT_URL>.git git拉#验证 如果克隆存储库 git克隆https://<USERNAME>:<TOKEN>@<GIT_URL>.git

还有一个非常简洁的脚本,有助于将HTTPS克隆的Git存储库转换为ssh协议,而无需删除和克隆Git存储库:

将HTTPS GitHub克隆转换为使用SSH