make SSHHOST include port, like a URL's host

This commit is contained in:
Grady Wong 2023-05-07 18:51:46 +08:00
parent 16f3430174
commit ee27407835
3 changed files with 4 additions and 4 deletions

View file

@ -228,5 +228,5 @@ func (l *Login) GetSSHHost() string {
return ""
}
return u.Hostname()
return u.Host
}

View file

@ -223,7 +223,7 @@ func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.L
return repo, &l, strings.TrimSuffix(path, ".git"), nil
}
} else if strings.EqualFold(p.Scheme, "ssh") {
if sshHost == p.Hostname() {
if sshHost == p.Host {
return repo, &l, strings.TrimLeft(p.Path, "/"), nil
}
}

View file

@ -90,8 +90,8 @@ func CreateLogin(name, token, user, passwd, sshKey, giteaURL, sshCertPrincipal,
}
// we do not have a method to get SSH config from api,
// so we just use the hostname
login.SSHHost = serverURL.Hostname()
// so we just use the host
login.SSHHost = serverURL.Host
if len(sshKey) == 0 {
login.SSHKey, err = findSSHKey(client)