You use fetchGit
:
repo = builtins.fetchGit {
url = "git@bitbucket.org:org/repo.git";
rev = "6364b4e00771a531c7df389a0b849d7cc40d2b68";
};
It fails with:
fatal: not a tree object: 6364b4e00771a531c7df389a0b849d7cc40d2b68
error: program 'git' failed with exit code 128
(use '--show-trace' to show detailed location information)
The problem is that there's also an invisible ref
parameter, defaulting to "master"
, and the commit must be reachable from that ref. So if you choose a commit that isn't in master, you have to specify the branch as well:
repo = builtins.fetchGit {
url = "git@bitbucket.org:org/repo.git";
ref = "some-branch";
rev = "6364b4e00771a531c7df389a0b849d7cc40d2b68";
};