【发布时间】:2018-02-17 00:05:15
【问题描述】:
我认为无论平台如何,SHA1 值都是相同的。我今天遇到了这个,我希望我能在这里得到一些澄清。
我的测试字符串是:'Apple Pie'
在 Bash 中:
echo 'Apple Pie' | git hash-object --stdin
23991897e13e47ed0adb91a0082c31c82fe0cbe5
在 CMD 中(Windows 10):
echo 'Apple Pie' | git hash-object --stdin
f554ff1fdde0e3c2ca9f67849791456302b5c12b
在 Powershell 5.0 (Windows 10) 中:
echo 'Apple Pie' | git hash-object --stdin
157cb7be4778a9cfad23b6fb514e364522167053
我现在很困惑 git 在这里是如何工作的,因为文件内容的 sha1 密钥在不同的环境中非常不同,我不确定如果我将一个项目克隆到我在 Powershell 中构建的 linux 机器中是否可以工作?这种行为在 git 或 SHA1 中是预期的吗?
【问题讨论】:
标签: bash git powershell hash sha1