import re


def get_browser_repo_url_from_git_url(git_url):
    """
    Converts a git https or ssh url to a corresponding browser url

    :param git_url: is the https or ssh git-clone format url
    :return: https browser-friendly url to the repo site
    """
    git_url = re.sub(r"\.git$", "", git_url)

    if git_url.startswith("git@"):
        return re.sub(r"^git@([^:]+):(.*)$", r"https://\1/\2", git_url)
    elif git_url.startswith("https://"):
        return re.sub(r"^https://([^@]+@)?(.*)$", r"https://\2", git_url)
    return ""