public static function init($path, $template_path = null, $shared = false)
    {
        pake_mkdirs($path);

        if (false === $shared)
            $shared = 'false';
        elseif (true === $shared)
            $shared = 'true';
        elseif (is_int($shared))
            $shared = sprintf("%o", $shared);

        $cmd = escapeshellarg(pake_which('git')).' init -q';

        if (null !== $template_path) {
            $cmd .= ' --template='.escapeshellarg($template_path);
        }

        $cmd .= ' --shared='.escapeshellarg($shared);

        $cwd = getcwd();
        chdir($path);
        chdir('.'); // hack for windows. see http://docs.php.net/manual/en/function.chdir.php#88617
        pake_sh($cmd);
        chdir($cwd);

        return new pakeGit($path);
    }