Git中心企业 - 远程:Git 操作无法使用密码验证

Github enterprise - remote: Password authentication is not available for Git operations

我的 git 工作正常,然后在没有任何改变的情况下开始出现以下问题, 我已尝试在

中重置缓存

credentials.helper

并且几乎遍历了我能找到的每一个 Whosebug 答案

remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://github.ibm.com/settings/tokens or
'https://github.ibm.com/WBurney/Blockchain_SDO.git/': 
The requested URL returned error: 403

谢谢

如果您已经为 GitHub 企业帐户注册了 public ssh 密钥,您可以使用 ssh url

来回避这个问题
cd /path/to/repo
git remote set-url origin git@github.ibm.com:WBurney/Blockchain_SDO.git

然后像 git push/git fetch/git pull/git ls-remote 这样的任何命令都会使用 git remote set-url 设置的 SSH URL。

但是关于您的原始问题,请尝试遵循“Creating a personal access token for the command line”。

如果您在 Mac、update your credentials from the OSX Keychain

您可能需要
(如 by RayLoveless

已接受的答案仅适用于 ssh,不适用于 https。

最近似乎更改了缓存重置命令。对我来说,最终成功了。

git credential reject
protocol=https
host=github.<YOUR_COMP>.com
git remote set-url origin git@github.ibm.com:WBurney/Blockchain_SDO.git

上面的 git 命令将起作用

试试下面一个 -

git clone https://<user-name>:<git-token>@<github-path.git>

另一个对我有用的解决方案是 通过 Windows 凭据管理器更改凭据:

1) 清除缓存的凭据(感谢@Rayloveless)。

2) 按照 this link 中的步骤创建访问令牌。

  • 在任意页面的 upper-right 一角,单击您的个人资料照片。
  • 点击设置
  • 在左侧边栏中,点击开发者设置
  • 个人访问令牌
  • 生成新令牌

3) 转到 "Windows Credential Manager" 并查找您的 Github 企业帐户。

4) 单击修改并将密码替换为您生成的令牌。

对我来说,当我删除旧生成的令牌并生成新令牌并使用它时,它起作用了

您需要重置凭据。打开 GIT CMD 并在下面输入命令

git credential reject

按回车键。光标将等待下一个输入。然后输入

protocol=https
host=git.example.com

将 git.example.com 替换为您的 link。

按两次“enter”让git知道命令结束。现在,在任何 git 操作之前,您需要做两件事,因为它将首先验证您的用户名和密码。

  1. 用户名 - 它会出现在您的徽标附近,登录为。例如这是我的。给出准确的用户名 -

  1. 密码-
  • 点击设置
  • 在左侧边栏中,点击开发者设置
  • 个人访问令牌
  • 生成新的令牌(将此令牌复制到某处。它不会再次出现)

接下来,转到 git cmd 并执行 git 操作。 例如 -

git clone https://consulting-github.com/Rohan-Chikorde/example.git

启动后,会提示输入用户名和密码。提供用户名示例:Rohan-Chikorde 和密码:e67682yourgeneratedtoken 如上所述,您就可以开始了。

对我来说,这是一个简单的过程,因为

  1. 生成我的token
  2. git remote remove origin
  3. git remote add origin https://<token>@<git_url>.git
  4. 现在再次尝试命令(推、拉、..)。

推送到 Github

时,请输入您的 GitHub 电子邮件 而不是 用户名