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

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计划的一部分,很快将是永久的服务变化


当前回答

如果你不想以纯文本形式存储你的令牌(通过修改远程回购的URL),你可以这样做:

通过遵循官方链接生成一个新的令牌 通过单击下面的按钮,确保复制了令牌。如果你双击文本并复制它,它会增加一个额外的空格,你会继续得到相同的错误(即使你不再使用你的密码,但令牌)

其他回答

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

这样就可以开始了。

你不需要拆遥控器。添加一个新的,然后拉(根据已接受的答案)。

对我来说最简单的解决方案(在Linux上)是使用gh自动登录并遵循CLI指示。不需要采取进一步措施。

如果您没有gh,根据您的操作系统根据下面的链接安装它。

如果你不想以纯文本形式存储你的令牌(通过修改远程回购的URL),你可以这样做:

通过遵循官方链接生成一个新的令牌 通过单击下面的按钮,确保复制了令牌。如果你双击文本并复制它,它会增加一个额外的空格,你会继续得到相同的错误(即使你不再使用你的密码,但令牌)

GitHub已禁用密码认证,且不再支持密码认证。创建并使用个人访问令牌(PAT)而不是密码。

以下步骤:

Remove GitHub stored credentials from the keychain. (For example, using "Keychain Access" on Mac, or "Credential Manager" on Windows) Generate access-token from GitHub Settings → Developer Settings → Personal access tokens → Generate new token Save the token - as it will be available there for once only Run command git fetch (or git push, if fetching doesn't require permissions) If on Windows, you must run this from PowerShell, not the command prompt (CMD). The command prompt consistently fails with the remote: Password authentication is temporarily disabled message, despite identical inputs. It will ask for your user name and password. If it does not ask you for your username and password, you must change your Git remote URL to contain your username: https://USERNAME@github.com/repo-owner/repo-name.git (see approach 2 for instructions on changing remote URL) Use the access token instead of the password when it asks for a password (you will have to enter it twice)

或者第二种方法:

从GitHub生成访问令牌: 设置→开发人员设置→个人访问令牌→生成新的令牌 在本地更新origin的URL: git remote set-url origin https://<token>@<git_url>.git 拉一次:git拉https://<token>@<git_url>.git

下面的步骤对我来说非常有效

以下步骤:

从GitHub生成一个访问令牌,设置→开发者设置→个人访问令牌→生成新的令牌 保存令牌-因为它只在那里可用一次 在系统中搜索。git-credential文件 在该文件中,在用户名之后使用访问令牌而不是密码。