def init():
    """
    Initialize the Git repository.
    """
    dirname = repo()
    try:
        os.makedirs(dirname)
        if util.via_sudo():
            uid = int(os.environ['SUDO_UID'])
            gid = int(os.environ['SUDO_GID'])
            os.chown(dirname, uid, gid)
    except OSError:
        pass
    try:
        p = subprocess.Popen(['git',
                              '--git-dir', dirname,
                              'init',
                              '--bare',
                              '-q'],
                             close_fds=True,
                             preexec_fn=unroot,
                             stdout=sys.stderr,
                             stderr=sys.stderr)
    except __HOLE__:
        logging.error('git not found on PATH - exiting')
        sys.exit(1)
    p.communicate()
    if 0 != p.returncode:
        #sys.exit(p.returncode)
        raise GitError(p.returncode)
dataset/ETHPy150Open devstructure/blueprint/blueprint/git.py/init