I am trying to get one directory from one remote repository but I only want to get that file from a specific hash. If I use git archive with HEAD everything is OK but when I try with a specific hash:
git archive -v --format tar --remote=ssh://....myrepo.git agithash afile > output.tgz
But I'm getting
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
So I've read that I could use another upload-archive like this:
git archive -v --format tar --remote=ssh:.....myrepo.git --exec="/usr/local/bin/git upload-archive" ahash afile > output.tgz
It didn't work either. I assume is because BitBucket does not support it as per https://confluence.atlassian.com/bitbucketserverkb/git-upload-archive-archiver-died-with-error-779171761.html
So I wonder: is there another simple way to do this?
If that commit is referenced by a branch, You could do a shallow clone directly at the right commit:
And then make an archive.
But you cannot directly get or clone a specific commit, for security reason.