Macos git存档--格式=tar头:mydir/| tar t->;致命:当前工作目录未跟踪

Macos git存档--格式=tar头:mydir/| tar t->;致命:当前工作目录未跟踪,macos,git,Macos,Git,我正在尝试归档git存储库中的文件夹: git archive --format=tar HEAD:mydir/ | tar t 但是,我收到的错误消息是: fatal: current working directory is untracked 我遵循的指示是正确的 我的git版本是:2.1.2 一次搜索只找到了6个链接,都是几年前的链接,看起来不相关。解决方案是: cd $myrepo/mydir git archive --format=tar HEAD ./ | tar t 是

我正在尝试归档git存储库中的文件夹:

git archive --format=tar HEAD:mydir/ | tar t
但是,我收到的错误消息是:

fatal: current working directory is untracked
我遵循的指示是正确的

我的git版本是:2.1.2

一次搜索只找到了6个链接,都是几年前的链接,看起来不相关。

解决方案是:

cd $myrepo/mydir
git archive --format=tar  HEAD ./ | tar t

是的,我也认为
HEAD:
中冒号后面的路径实际上是git根的完整路径,结果它是相对于当前位置的,然后。。。(但只有在不使用冒号的情况下,正如您发布的那样)