我正在尝试从一个远程仓库获取一个目录,但我只想从特定的哈希值中获取那个文件。如果我使用带有HEAD的git存档,则一切正常,但是当我尝试使用特定哈希值时:
git archive -v --format tar --remote=ssh://....myrepo.git agithash afile > output.tgz
但是我得到了以下错误:
git archive -v --format tar --remote=ssh://....myrepo.git agithash afile > output.tgz
但是我得到了以下错误:
fatal: sent error to the client: git upload-archive: archiver died with error
remote: fatal: no such ref: 9a9c309
remote: git upload-archive: archiver died with error
我读到可以使用以下命令之一来进行上传归档:
git archive -v --format tar --remote=ssh:.....myrepo.git --exec="/usr/local/bin/git upload-archive" ahash afile > output.tgz
但它也没有起作用。我认为这是因为BitBucket不支持,就像https://confluence.atlassian.com/bitbucketserverkb/git-upload-archive-archiver-died-with-error-779171761.html中所述。
那么,是否还有其他简单的方法来完成此操作呢?