【问题标题】:Create git tree manually from file on Windows (Git Bash)从 Windows 上的文件手动创建 git 树 (Git Bash)
【发布时间】:2020-12-06 10:59:04
【问题描述】:

我正在学习一个 Git 教程,我想从一个文件中创建一棵树。我在 Windows 10 计算机上使用 Git bash。该文件有以下内容:

100644 blob b7aec520dec0a7516c18eb4c68b64ae1eb9b5a5e file1.txt
100644 blob 4400aae52a27341314f423095846b1f215a7cf08 file2.txt

我要使用命令

cat ../temp-tree.txt | git mktree

读取文件并创建树。运行命令后出现错误

fatal: input format error: 100644 blob b7aec520dec0a7516c18eb4c68b64ae1eb9b5a5e file1.txt

我认为这是行尾格式或类似问题的问题,因为我认为语法应该是正确的

【问题讨论】:

  • 文件名前是(空格)还是(制表符)? (应该是一个标签)
  • 非常感谢,问题解决了!

标签: windows git format cat


【解决方案1】:

为了记录,确切的预期格式是

<mode>SPACE<type>SPACE<object>TAB<file>
# for example
100644 blob b7aec520dec0a7516c18eb4c68b64ae1eb9b5a5e    file1.txt

...所以文件中对象哈希和文件名之间的(空格)应该是一个(制表符)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 1970-01-01
    • 2015-03-01
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    • 2019-02-10
    相关资源
    最近更新 更多