Clone a local repo from that URL to that path

    If path is not given, then use the git default: same as repo name
    If path is given and remove is True
        then the path is removed before cloning

    Because this is run from a script it is assumed that user should be Admin
        so set config user values for the GitLab Admin

def clone(url, path=None, remove=True):
    """Clone a local repo from that URL to that path

    If path is not given, then use the git default: same as repo name
    If path is given and remove is True
        then the path is removed before cloning

    Because this is run from a script it is assumed that user should be Admin
        so set config user values for the GitLab Admin
    """
    clean = True
    if path and os.path.isdir(path):
        if not remove:
            clean = False
        else:
            shutil.rmtree(path)
    if clean:
        stdout = run('clone %s %s' % (url, path or ''))
        into = stdout.splitlines()[0].split("'")[1]
        path_to_clone = os.path.realpath(into)
    else:
        path_to_clone = path
    old_dir = _working_dirs[0]
    _working_dirs[0] = path_to_clone
    config('user.name', 'Release Script')
    config('user.email', 'gitlab@wwts.com')
    _working_dirs[0] = old_dir
    return path_to_clone