在Git Bash中,我尝试使用以下命令:
$ git archive -o test.tar.gz master gzip: compressed data not written to a terminal. Use -f to force compression. For help, type: gzip -h
该文件test.tar.gz
为空,但是我的存储库也不为空,并且创建一个zip文件可以正常工作(包含我的所有源文件)!为什么tarball格式无法生成存档?
这似乎是git archive
要从中tar
传送内容gzip
的方式与Windows处理管道的方式之间的兼容性问题。您可以通过管道产生相同的错误消息tar
为gzip
手动:
$ tar -c file.txt | gzip gzip: compressed data not written to a terminal. Use -f to force compression. For help, type: gzip -h
这两个命令在Windows 7上对我有用,并且在功能上应与您尝试使用的命令相同:
$ git archive -o test.tar master $ gzip test.tar