jesseduffield/lazygit · warning
Failed to parse repo information from url
Error message
Failed to parse repo information from url
What it means
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.
Source
Thrown at pkg/commands/hosting_service/hosting_service.go:232
func (self ServiceDefinition) getRepoNameFromRemoteURL(url string) (string, error) {
matches, err := self.parseRemoteUrl(url)
if err != nil {
return "", err
}
return utils.ResolvePlaceholderString(self.repoNameTemplate, matches), nil
}
func (self ServiceDefinition) parseRemoteUrl(url string) (map[string]string, error) {
for _, re := range self.urlRegexps {
matches := utils.FindNamedMatches(re, url)
if matches != nil {
return matches, nil
}
}
return nil, errors.New("Failed to parse repo information from url")
}
// RepoInformation holds the owner and repository name parsed from a remote URL.
type RepoInformation struct {
Owner string
Repository string
}
// GetRepoInfoFromURL parses a remote URL (SSH or HTTPS) and extracts the
// owner and repository name using the default URL regex patterns.
func GetRepoInfoFromURL(url string) (RepoInformation, error) {
for _, re := range defaultUrlRegexps {
matches := utils.FindNamedMatches(re, url)
if matches != nil {
return RepoInformation{
Owner: matches["owner"],
Repository: matches["repo"],
}, nilView on GitHub (pinned to c477a2959b)
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
Example fix
# before origin https://git.example.com/team/sub/repo.git # extra path segment -> parse fails # after # flatten to owner/repo shape, or override in lazygit config: services: "git.example.com": "gitlab:git.example.com" git: overrideGpg: false
Defensive patterns
Strategy: fallback
Validate before calling
if _, err := hostingService.GetRepoInformation(); err != nil {
// before relying on parsed info, sanity-check the remote shape:
u := remoteURL
ok := strings.HasPrefix(u, "http") || strings.Contains(u, "@") || strings.HasSuffix(u, ".git")
if !ok {
return fmt.Errorf("remote %q not a parsable git URL", u)
}
} Try / catch
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.
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Unsupported git service
- unable to parse filter regex, error: {{err}}
- Error in commitPrefix pattern: %s
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/f943180df0da8276.
Report an issue: GitHub.