mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-10-31 01:05:26 +01:00 
			
		
		
		
	fix: support SSH remotes with non-standard ports (#761)
The SSH host matching logic in contextFromLocalRepo only compared exact host:port combinations. This failed for SSH remotes using non-standard ports because the login SSH host configuration typically stores just the hostname without the port. This change allows matching both the full host:port string and the hostname-only version against the configured SSH host, enabling tea to work with SSH remotes on non-standard ports. Fixes issue where commands requiring RemoteRepo failed with 'Remote repository required' error when using SSH on custom ports. Signed-off-by: JD Daniels <jd@danielsdynamic.ca> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/761 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: JD Daniels <jd@danielsdynamic.ca> Co-committed-by: JD Daniels <jd@danielsdynamic.ca>
This commit is contained in:
		| @@ -222,7 +222,7 @@ func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.L | |||||||
| 					return repo, &l, strings.TrimSuffix(path, ".git"), nil | 					return repo, &l, strings.TrimSuffix(path, ".git"), nil | ||||||
| 				} | 				} | ||||||
| 			} else if strings.EqualFold(p.Scheme, "ssh") { | 			} else if strings.EqualFold(p.Scheme, "ssh") { | ||||||
| 				if sshHost == p.Host { | 				if sshHost == p.Host || sshHost == p.Hostname() { | ||||||
| 					return repo, &l, strings.TrimLeft(p.Path, "/"), nil | 					return repo, &l, strings.TrimLeft(p.Path, "/"), nil | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 JD Daniels
					JD Daniels