【问题标题】:Different hashes when using git hash-object --stdin in bash and cmd shells在 bash 和 cmd shell 中使用 git hash-object --stdin 时的不同哈希值
【发布时间】:2017-03-02 01:24:52
【问题描述】:

回声“苹果派”| git hash-object --stdin

当我在 Git Bash shell 中发出命令时,我得到 23991897e13e47ed0adb91a0082c31c82fe0cbe5 和 CMD Shell 中的相同命令我得到 bb3918d5053fea31fc9a58fae1e5bdeabe3ec647

谁能告诉我他们为什么不同?更重要的是,如果我在同一个存储库上使用不同的 shell,这种行为是否会对我的本地 git 存储库产生影响?

我在 Windows 7 上使用 git 版本 2.9.2.windows.1

【问题讨论】:

    标签: windows git


    【解决方案1】:

    在 Git bash shell 中,echo "Apple Pie" 打印出 Apple Pie\n

    在 CMD shell 中,它打印"Apple Pie"\r\n

    1. 双引号
    2. 换行

    内容不同,所以哈希值不一样。

    您可以通过echo "Apple Pie" > xxx.txt 将输出制作成文件。使用具有十六进制模式的记事本++等编辑器打开文件。双引号很明显。观察换行符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-14
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2016-04-09
      • 1970-01-01
      • 2015-09-26
      相关资源
      最近更新 更多