{"record":{"id":"f943180df0da8276","repo":"jesseduffield/lazygit","slug":"failed-to-parse-repo-information-from-url","errorCode":null,"errorMessage":"Failed to parse repo information from url","messagePattern":"Failed to parse repo information from url","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/commands/hosting_service/hosting_service.go","lineNumber":232,"sourceCode":"\nfunc (self ServiceDefinition) getRepoNameFromRemoteURL(url string) (string, error) {\n\tmatches, err := self.parseRemoteUrl(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn utils.ResolvePlaceholderString(self.repoNameTemplate, matches), nil\n}\n\nfunc (self ServiceDefinition) parseRemoteUrl(url string) (map[string]string, error) {\n\tfor _, re := range self.urlRegexps {\n\t\tmatches := utils.FindNamedMatches(re, url)\n\t\tif matches != nil {\n\t\t\treturn matches, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"Failed to parse repo information from url\")\n}\n\n// RepoInformation holds the owner and repository name parsed from a remote URL.\ntype RepoInformation struct {\n\tOwner      string\n\tRepository string\n}\n\n// GetRepoInfoFromURL parses a remote URL (SSH or HTTPS) and extracts the\n// owner and repository name using the default URL regex patterns.\nfunc GetRepoInfoFromURL(url string) (RepoInformation, error) {\n\tfor _, re := range defaultUrlRegexps {\n\t\tmatches := utils.FindNamedMatches(re, url)\n\t\tif matches != nil {\n\t\t\treturn RepoInformation{\n\t\t\t\tOwner:      matches[\"owner\"],\n\t\t\t\tRepository: matches[\"repo\"],\n\t\t\t}, nil","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/commands/hosting_service/hosting_service.go#L214-L250","documentation":"ServiceDefinition.parseRemoteUrl tries each configured URL regexp (HTTP(S) and SSH shapes) against the remote URL and requires a named-match (owner/repository). If none match, the URL is in a form the service definition doesn't understand and repo information can't be extracted for building web/API URLs.","triggerScenarios":"URLs with non-standard schemes (git://, ftp), extra path components (multiple path segments where the regex expects one), ports in unusual positions, trailing '.git' variations not covered, or remote names/aliases instead of URLs.","commonSituations":"Self-hosted instances nested under prefixes like https://git.example.com/group/subgroup/repo.git where the default regex can't pick owner/repo; exotic clone URLs from mirrors.","solutions":["Set the repo info explicitly in config via the service's `repoUrls` (e.g. `services: 'mygit.example.com:gitlab:mygit.example.com'` plus a repoUrlTemplate override) so parsing is skipped","Normalize the remote URL to a standard SSH or HTTPS form: `git remote set-url origin git@example.com:owner/repo.git`","Verify with `git remote -v` that the URL is an actual URL, not an alias or local path"],"exampleFix":"# before\norigin  https://git.example.com/team/sub/repo.git  # extra path segment -> parse fails\n\n# after\n# flatten to owner/repo shape, or override in lazygit config:\nservices:\n  \"git.example.com\": \"gitlab:git.example.com\"\ngit:\n  overrideGpg: false","handlingStrategy":"fallback","validationCode":"if _, err := hostingService.GetRepoInformation(); err != nil {\n    // before relying on parsed info, sanity-check the remote shape:\n\tu := remoteURL\n\tok := strings.HasPrefix(u, \"http\") || strings.Contains(u, \"@\") || strings.HasSuffix(u, \".git\")\n\tif !ok {\n\t\treturn fmt.Errorf(\"remote %q not a parsable git URL\", u)\n\t}\n}","typeGuard":null,"tryCatchPattern":"Catch the parse failure and fall back to explicit configuration: set the hosting service's repo URL template / manual repoUrls in lazygit config, or normalize the remote URL with `git remote set-url`, then retry once.","preventionTips":["Prefer canonical SSH (git@host:owner/repo.git) or HTTPS remote URLs","For nested-group instances, configure a repoUrlTemplate override","Validate remote URLs after cloning from mirrors or internal portals"],"tags":["hosting-service","url-parsing","remote-url","regex"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}