public function getGitCommitHash() : string
{
$projectRoot = $this->session['dir'];
if (!\is_dir($projectRoot . '/.git')) {
throw new \Exception(".git directory not found!");
}
$command = "/usr/bin/env bash -c 'echo OK'";
if (\rtrim(\shell_exec($command)) !== 'OK') {
throw new \Exception("Can't invoke bash");
}
$dir = \getcwd();
\chdir($projectRoot);
$hash = \rtrim(\shell_exec("git rev-parse HEAD"));
\chdir($dir);
return $hash;
}