Use the SSH alias in the Git remote when that alias owns the proxy route:

Host code-via-proxy
    HostName git.example.net
    User git
    ProxyCommand nc -X connect -x proxy.example.net:8080 %h %p

code-via-proxy is matched against the supplied SSH name. HostName then identifies the real server. The example needs OpenBSD-compatible netcat: -X connect requests HTTP CONNECT to the SSH destination.

For a new checkout:

git clone git@code-via-proxy:team/project.git

For an existing checkout:

git remote set-url origin git@code-via-proxy:team/project.git

Substitute the real repository path. The alias changes connection selection, not the repository's identity on its server. For a public Git SSH server on a network allowing a public intermediary, the HTTP proxy list supplies candidates for the proxy host and port. Use the no-proxy-account example only with a node that permits CONNECT to the actual SSH destination and port.

A remote using [email protected]:team/project.git instead matches git.example.net. It does not select the alias merely because the alias's HostName points there. Either use the alias or place the intended rule under the real name.

Review earlier matching blocks too. For most SSH options the first obtained value wins, so put specific settings before broad defaults defining the same option.

Erthyglow kevrennek