我正在尝试从一个远程存储库获取一个目录,但我只想从特定的哈希中获取该文件。如果我使用带有 HEAD 的 git archive 一切正常,但是当我尝试使用特定的哈希时:
git archive -v --format tar --remote=ssh://....myrepo.git agitash 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
所以我想知道:还有另一种简单的方法可以做到这一点吗?
如果该提交被分支引用,您可以直接在正确的提交处进行浅克隆:
git clone <url> --depth=1 --branch <branch_name> -- <folder_name>
然后做好存档。
但你不能直接获取或克隆特定提交,出于安全原因。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)