为什么我运行git archive时出现“remote:fatal:path not found:HEAD”错误?

时间:2014-02-20 03:37:43

标签: git

我正试图从我的git repo中提取单个文件,就像这样......

$ git archive --remote=red-git:/opt/red-git/RED-puppet.git development HEAD:usr/local/scripts/apply.sh | tar -xvf -

......但它不起作用。我收到此错误消息。

remote: fatal: path not found: HEAD:usr/local/scripts/apply.sh
remote: git upload-archive: archiver died with error
fatal: sent error to the client: git upload-archive: archiver died with error
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

我知道如何从git中提取单个文件有很多问题和答案, 但他们都没有能够向我解释为什么我会收到错误:

remote: fatal: path not found: HEAD:usr/local/scripts/apply.sh

我知道shell脚本在那里,因为我可以这样做......

$ git archive --remote=red-git:/opt/red-git/RED-puppet.git development | tar -xvf - | grep apply.sh
...
usr/local/scripts/apply.sh

1 个答案:

答案 0 :(得分:0)

在将我的HEAD撞到墙上并且发现了很多错误之后,我遇到了这个诀窍的命令行:

git archive --remote=red-git:/opt/red-git/RED-puppet.git development usr/local/scripts/apply.sh | tar -xvf -

HEAD:。好,我还不确定那是什么意思。 :)