async function initGit(withRemote) {
  const cwd = temporaryDirectory();
  const args = withRemote ? ["--bare", "--initial-branch=master"] : ["--initial-branch=master"];

  await execa("git", ["init", ...args], { cwd }).catch(() => {
    const args = withRemote ? ["--bare"] : [];
    return execa("git", ["init", ...args], { cwd });
  });
  const repositoryUrl = fileUrl(cwd);
  return { cwd, repositoryUrl };
}
Initialize git repository
If `withRemote` is `true`, creates a bare repository and initialize it.
If `withRemote` is `false`, creates a regular repository and initialize it.

@param {Boolean} withRemote `true` to create a shallow clone of a bare repository.
@return {String} The path of the repository