【问题标题】:Github enterprise - remote: Password authentication is not available for Git operationsGithub 企业 - 远程:密码验证不适用于 Git 操作
【发布时间】:2017-08-27 08:31:55
【问题描述】:

我的 git 工作正常,然后没有改变任何东西,但以下问题开始发生, 我尝试在

中重置缓存

credentials.helper

并且已经阅读了我能找到的几乎所有 stackoverflow 答案

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

谢谢

【问题讨论】:

  • I have tried resetting the cache ...您实际上做了什么?您可能已经阅读了很多答案,但我们不知道您做了什么来达到这种状态。

标签: git github github-enterprise


【解决方案1】:

如果您已将公共 ssh 密钥注册到您的 GitHub 企业帐户,则可以使用 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

您可能需要remove an old cached credential first
(作为commentedRayLoveless

【讨论】:

  • 我按照以下步骤将我的 ssh 密钥添加到 git git.ng.bluemix.net/help/ssh/README.md 然后我使用 git remote set-url origin git@github.ibm.com:WBurney/Blockchain_SDO.git 设置远程 URL 谢谢寻求帮助
  • @MuhammadRaafayKhan 你的操作系统和 git 版本是什么?
  • Ubuntu 17.04 和 git 版本 2.11.0
  • 您可能需要清除凭据缓存,以便系统提示您输入密码/令牌:stackoverflow.com/questions/15381198/…
  • @RayLoveless True:Mac 上的“erase”命令或 Windows 上的“reject”:stackoverflow.com/a/59890860/6309
【解决方案2】:

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

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

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

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

3) 转到“Windows 凭据管理器”并查找您的 Github Enterprise 帐户。

4) 点击修改,将密码替换为你生成的token。

【讨论】:

  • 添加链接是可以的,但你应该提供一个例子来保持你的答案有效,以防链接被删除
  • 这是为我做的。谢谢!
  • 谢谢。我需要清除缓存的凭据。
  • 非常感谢。它对我有用。
  • 这就是诀窍!
【解决方案3】:

试试下面的一个 -

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

【讨论】:

    【解决方案4】:

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

    缓存重置推荐似乎最近发生了变化。对我来说,最终让它发挥了作用。

    git credential reject
    protocol=https
    host=github.<YOUR_COMP>.com
    

    【讨论】:

    • 需要在末尾输入一个空行(按两次)表示添加数据完成。
    【解决方案5】:

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

    git credential reject
    

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

    protocol=https
    host=git.example.com
    

    将 git.example.com 替换为您的链接。

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

    1. 用户名 - 它会显示在您的徽标附近,并以登录身份显示。这是我的例子。提供准确的用户名 -

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

    接下来,进入 git cmd 并进行 git 操作。 例如 -

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

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

    【讨论】:

      【解决方案6】:

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

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

      【讨论】:

        【解决方案7】:

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

        【讨论】:

          【解决方案8】:

          推送到 Github 时,输入您的 GitHub 电子邮件,而不是您的 用户名

          【讨论】:

            【解决方案9】:
            git remote set-url origin git@github.ibm.com:WBurney/Blockchain_SDO.git
            

            上面的 git 命令可以工作

            【讨论】:

              猜你喜欢
              • 2019-02-19
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2023-02-04
              • 2023-01-24
              • 2013-02-15
              • 2021-10-22
              相关资源
              最近更新 更多