【问题标题】:Update git submodules更新 git 子模块
【发布时间】:2020-11-05 09:18:27
【问题描述】:

在尝试更新 git 子模块时,我看到以下错误:

Submodule 'paa' (https://github.com/microsoftgraph/paa.git) registered for path 'paa'
Cloning into 'D:/a/1/s/paa'...
git: 'credential-manager-core' is not a git command. See 'git --help'.
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: clone of 'https://github.com/microsoftgraph/paa.git' into submodule path 'D:/a/1/s/paa' failed
Failed to clone 'paa'. Retry scheduled
Cloning into 'D:/a/1/s/paa'...
git: 'credential-manager-core' is not a git command. See 'git --help'.
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: clone of 'https://github.com/microsoftgraph/paa.git' into submodule path 'D:/a/1/s/paa' failed
Failed to clone 'paa' a second time, aborting
##[error]Git submodule update failed with exit code: 1

我引用了Fatal Error when updating submodule using GIT堆栈溢出帖子,.gitmodules 已经有以下内容:

[submodule "paa"]
    path = paa
    url = https://github.com/microsoftgraph/paa.git

更新:

根据以下答案,我添加了一个路径,如下所示:

C:\Program Files\Git\bin
C:\Program Files\Git\cmd
C:\Program Files\Git\usr\bin
C:\Program Files\Git\mingw64\bin
C:\Program Files\Git\mingw64\libexec\git-core

我仍然看到同样的错误。我尝试将 .gitmodules 中的内容更新为以下内容:

[submodule "paa"]
    path = paa
    url = https://<username>:<password>@github.com/microsoftgraph/paa.git

我看到了这个错误:

Submodule 'paa' (https://<username>:<password>@github.com/microsoftgraph/paa.git) registered for path 'paa'
Cloning into 'D:/a/1/s/paa'...
fatal: unable to access 'https://<username>:<password>@github.com/microsoftgraph/paa.git/': Could not resolve host: <username>:<password>@github.com
fatal: clone of 'https://<username>:<password>@github.com/microsoftgraph/paa.git' into submodule path 'D:/a/1/s/paa' failed

【问题讨论】:

  • 证明你实际做了什么来得到这个的证据。 “credential-manager-core”是一个第三方插件,Git 不使用它,你没有展示你使用了什么。
  • 只是检查一下,你能进入你的回购并输入git config -l:你看到有insteadOf的任何设置吗?
  • 我看到了这个:url.git@github.com:.insteadof=github.com, url.github.com:.insteadof=git@github.com

标签: git github git-submodules


【解决方案1】:

对于我最近 (2.29) 的所有 Windows Git 安装,我必须将 %GH%\mingw64\libexec\git-core 添加到我的 PATHGH 是安装 Git 的路径)。
VonC/setupsenv commit f1a1dcd为例:

set PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;
set PATH=%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

这样,GCM (Microsoft Git-Credential-Manager-Core 变得可用,并且不再出现错误消息。

【讨论】:

  • 谢谢!问题 - 我在 C:\Program Files 中安装了 Git。我按照您的建议添加了路径(请参阅我更新的问题),但我仍然看到相同的错误。我错过了什么?
  • @user989988 返回命令where git-credential-manager-core 的内容。你使用的是什么版本的 Windows 版 Git?
  • 当我运行 git-credential-manager-core. PS C:\Users\alias> 其中 git-credential-manager-core PS C:\Users\alias> Git 版本是 git 版本 2.29.2.windows.1
  • @user989988 完全正确:PATH 设置不正确。尝试在您的用户环境变量中全局设置它,然后打开一个新的 CMD/Powershell 会话,然后重试。
  • 有道理 - 我设置 PATH 的过程是打开控制面板\系统和安全\系统 -> 高级系统设置 -> 环境变量 -> 路径 -> 编辑 -> 添加所有路径。您能否确认这是否是正确的方法?在运行 git config --list --show-origin 时,我看到 credential.helper=wincred
猜你喜欢
  • 1970-01-01
  • 2012-04-27
  • 2012-09-14
  • 1970-01-01
  • 2012-07-09
  • 2017-08-13
  • 2021-12-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多