fix(auth): rewrite remote repo host when SSH hostname maps to config host

Description

When a GitLab instance uses different hostnames for SSH and API (e.g., ssh.git.example.com vs git.example.com), the remote resolver recognizes the SSH host via the ssh_host config mapping but does not rewrite the remote Repo object. This causes downstream consumers like NewClientFromConfig to look up token and config under the SSH hostname, finding nothing.

Rewrite the remote Repo to use the API hostname when an SSH host mapping matches, in both the default and host-override code paths.

This ensures RepoHost() returns the hostname where credentials and API configuration are stored.

Relates #8195 (1st part)

How has this been tested?

Tested with our internal GitLab instance and the following config snippet:

hosts:
    git.example.test:
        api_host: git.example.test
        ssh_host: ssh.git.example.test
        git_protocol: ssh
        api_protocol: https
        user: myUserName

Screenshots (if appropriate):

Merge request reports

Loading