我试图用tar计算一个项目目录的哈希值,并将其压缩后以管道形式传送到 sha1sum
到目前为止,我有这个。
tar --exclude='.git' -cf - /path/to/my/project
然而,我最终得到的错误信息是:"tar:拒绝将存档内容写入终端(缺少-f选项?拒绝将存档内容写入终端(缺少-f选项?) "和 "tar: Error is not recoverable: exiting now"。
但如果我做 tar --exclude='.git' -cf - /path/to/my/project | sha1sum
它的工作原理 但我想检查一下.git文件夹是否真的被排除了?
你可以得到这样的文件列表。
tar --exclude='.git' -cvf - /path/to/my/project 2> /tmp/list-files.txt > /dev/null