{"record":{"id":"4b7b789cc5942f74","repo":"pypa/pip","slug":"url","errorCode":null,"errorMessage":"{url}","messagePattern":"\\{url\\}","errorType":"exception","errorClass":"RemoteNotValidError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/vcs/git.py","lineNumber":448,"sourceCode":"        Form 1 is output as-is. Form 2 must be converted to URI and form 3 must\n        be converted to form 1.\n\n        See the corresponding test test_git_remote_url_to_pip() for examples of\n        sample inputs/outputs.\n        \"\"\"\n        if re.match(r\"\\w+://\", url):\n            # This is already valid. Pass it though as-is.\n            return url\n        if os.path.exists(url):\n            # A local bare remote (git clone --mirror).\n            # Needs a file:// prefix.\n            return pathlib.Path(url).as_uri()\n        scp_match = SCP_REGEX.match(url)\n        if scp_match:\n            # Add an ssh:// prefix and replace the ':' with a '/'.\n            return scp_match.expand(r\"ssh://\\1\\2/\\3\")\n        # Otherwise, bail out.\n        raise RemoteNotValidError(url)\n\n    @classmethod\n    def has_commit(cls, location: str, rev: str) -> bool:\n        \"\"\"\n        Check if rev is a commit that is available in the local repository.\n        \"\"\"\n        try:\n            cls.run_command(\n                [\"rev-parse\", \"-q\", \"--verify\", rev + \"^{commit}\"],\n                cwd=location,\n                log_failed_cmd=False,\n            )\n        except InstallationError:\n            return False\n        else:\n            return True\n\n    @classmethod","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/vcs/git.py#L430-L466","documentation":"Raised by Git._git_remote_to_pip_url() (as a RemoteNotValidError) when a git remote URL does not match any of the three recognized forms: a fully-qualified URL (scheme://), an existing local bare-repo path, or SCP shorthand (user@host:path). The URL cannot be converted to a pip-installable requirement string.","triggerScenarios":"Calling get_remote_url() on a git checkout whose 'remote.origin.url' config value is none of: a URL with a scheme, an existing local path, or SCP shorthand. The error is raised at line 448 via RemoteNotValidError(url).","commonSituations":"A git remote configured with a malformed or non-standard URL. A remote using a protocol pip does not recognize. A manually edited .git/config with a broken remote URL. A remote URL that is a relative path rather than absolute.","solutions":["Check the remote URL: 'git -C <repo> config --get remote.origin.url'","Fix the remote URL to a recognized form (https://, ssh://, git@host:path, or an absolute local path)","Re-clone the repository from a valid remote URL","If installing from a local clone, use 'pip install <path>' instead of a git+ URL"],"exampleFix":"// before\n# remote.origin.url is a malformed value like 'repo'\ngit -C ./myrepo config --get remote.origin.url  # => 'repo'\npip install ./myrepo\n// after\n# fix the remote to a valid URL\ngit -C ./myrepo remote set-url origin https://example.com/repo.git\npip install ./myrepo","handlingStrategy":"validation","validationCode":"import re, os\n\nSCP_RE = re.compile(r'^(\\w+@)?([^/:]+):(\\w[^:]*)$')\n\ndef git_remote_is_valid(url: str) -> bool:\n    if re.match(r'\\w+://', url):\n        return True\n    if os.path.exists(url):\n        return True\n    if SCP_RE.match(url):\n        return True\n    return False\n\n# before relying on a git remote\nif not git_remote_is_valid(remote_url):\n    raise ValueError(f'git remote URL is not valid: {remote_url}')","typeGuard":"import re, os\n\ndef is_valid_git_url(url: str) -> bool:\n    return bool(re.match(r'\\w+://', url)) or os.path.exists(url) or bool(re.match(r'^(\\w+@)?([^/:]+):(\\w[^:]*)$', url))","tryCatchPattern":"from pip._internal.vcs.versioncontrol import RemoteNotValidError\n\ntry:\n    url = Git.get_remote_url(location)\nexcept RemoteNotValidError as e:\n    raise ConfigError(f'fix the git remote URL: {e.url}')","preventionTips":["Set remote URLs to recognized forms (https://, ssh://, git@host:path, absolute path)","Verify with 'git config --get remote.origin.url' before pip install","Use 'pip install <local-path>' for local clones instead of VCS URLs","Re-clone from a valid remote if the config is broken"],"tags":["git","vcs","remote-url","url","installation"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}