Revert to ignoring non-github.com git remotes
This fixes a regression where extra git remotes pointing to non-github.com hostnames could result in gh trying to parse repository information from them.
This commit is contained in:
parent
89adc83194
commit
f93261a6f9
1 changed files with 13 additions and 1 deletions
|
|
@ -240,10 +240,22 @@ func (c *fsContext) Remotes() (Remotes, error) {
|
|||
}
|
||||
|
||||
sshTranslate := git.ParseSSHConfig().Translator()
|
||||
c.remotes = translateRemotes(gitRemotes, sshTranslate)
|
||||
resolvedRemotes := translateRemotes(gitRemotes, sshTranslate)
|
||||
|
||||
// ignore non-github.com remotes
|
||||
// TODO: GHE compatibility
|
||||
filteredRemotes := Remotes{}
|
||||
for _, r := range resolvedRemotes {
|
||||
if r.RepoHost() != defaultHostname {
|
||||
continue
|
||||
}
|
||||
filteredRemotes = append(filteredRemotes, r)
|
||||
}
|
||||
c.remotes = filteredRemotes
|
||||
}
|
||||
|
||||
if len(c.remotes) == 0 {
|
||||
// TODO: GHE compatibility
|
||||
return nil, errors.New("no git remote found for a github.com repository")
|
||||
}
|
||||
return c.remotes, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue