【问题标题】:git clone failure with "--stdin requires a git repository fatal: fetch-pack: invalid index-pack output"git clone 失败,“--stdin 需要一个致命的 git 存储库:fetch-pack:invalid index-pack output”
【发布时间】:2021-12-04 13:34:37
【问题描述】:

我刚刚在 github.com 上创建了一个带有 README.md 文件的私有仓库。我试图在我的笔记本电脑上克隆 repo。我收到以下错误并且克隆失败,即未创建目录/repo。

git clone https://github.com/XYZ/TestGit01.git

Cloning into 'TestGit01'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: --stdin requires a git repository
fatal: fetch-pack: invalid index-pack output

我的操作系统是 Windows 10

【问题讨论】:

  • git config --list | grep -F -- --stdin
  • @phd 我查看了我的配置文件。我没有标准输入字符串。
  • 这令人费解。如果您可以提供minimal reproducible example,那可能有助于其他人调试它。
  • @RT。另一种猜测——你已经配置了一个模板目录——或者是git config init.templateDir或者git clone --template或者你有git config core.hooksPath——并且post-checkout钩子中有一个错误。
  • @phd -- 宾果游戏!我之前配置了一个模板目录,以使我的默认分支为“main”而不是“master”。我的 c:/users/xyz/.gitconfig 有以下条目: [init] templateDir = ~/.config/git/template/ 我删除了这个条目,现在可以毫无问题地克隆。太感谢了。我如何将您的建议作为答案?

标签: git clone fatal-error


【解决方案1】:

你已经配置了一个模板目录,post-checkout钩子有bug。

【讨论】:

    猜你喜欢
    • 2010-12-28
    • 2015-07-30
    • 2018-03-07
    • 2019-01-01
    • 2020-06-29
    • 1970-01-01
    • 2019-04-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多