title: Git over ssh is ignoring the ssh config
body: <p>So, I've been messing around with this for a little while now, but git is still acting up. While ssh works just fine now, git is seemingly ignoring my ssh config but I at least know it works when I specify the port and key with a <code>sshCommand</code> in the <code>.git/config</code> in the repository in question.</p>
  <p>Pure ssh works just fine using the config file, however, I'm using Github deploy keys, so my ssh config looks more like this:</p>
  <pre><code>host test
          Hostname ssh.github.com
          User git
          Port 443
          IdentityFile ~/.ssh/id_ed25519-test.github
          IdentitiesOnly yes
  host test2
          Hostname ssh.github.com
          User git
          Port 443
          IdentityFile ~/.ssh/id_ed25519-test2.github
          IdentitiesOnly yes
  </code></pre>
  <p>Still haven't had any problems connecting using ssh, but I <em>think</em> my problems come down to some misunderstanding I have over how host and hostname work, probably? Not really sure, nothing really stood out from the <code>man</code> page for ssh_config and ssh.</p>
  <p>Due to work related reasons, primarily that our VPN is kinda wonky, I need to use port 443.</p>
  <p>Strangely, ssh does not work using <code>github.com</code> as the <code>Hostname</code>, only when it is <code>ssh.github.com</code>. I had problems connecting to it, and just came across that in an example in Github's docs but otherwise not mentioned. Tested with it and it has worked fine since.</p>
  <p>This also plays into the remote in the git repo, as I need to append <code>ssh.</code> there too. <code>git remote add orgin git@github.com:user/test.git</code> does not work but <code>git remote origin2 git@ssh.github.com:user/test.git</code> does. I've tested if git can connect by running <code>git remote show &lt;remote&gt;</code> and replacing <code>&lt;remote&gt;</code> with either <code>origin</code> or <code>origin2</code>.</p>
  <p>However, without specifying the <code>sshCommand</code> to be <code>sshCommand = ssh -p 443 -i ~/.ssh/id_ed25519-test.github</code>, it will not connect.</p>
  <p>I've tried debugging using this:</p>
  <pre><code>GIT_TRACE=true \                                                                  at 11:17:27
  GIT_CURL_VERBOSE=true \
  GIT_SSH_COMMAND=&quot;ssh -vvv&quot; \
  GIT_TRACE_PACK_ACCESS=true \
  GIT_TRACE_PACKET=true \
  GIT_TRACE_PACKFILE=true \
  GIT_TRACE_PERFORMANCE=true \
  GIT_TRACE_SETUP=true \
  GIT_TRACE_SHALLOW=true \
  git remote show &lt;remote&gt;
  </code></pre>
  <p>While using <code>git</code>, though I've sometimes removed the <code>GIT_SSH_COMMAND=&quot;ssh -vvv&quot; \</code> part of it since it seems to overwrite the git config file, which isn't that surprising I suppose.</p>
  <p>If I specify the key in the debug ssh_command, it at least chooses that one, but it is still trying to connect to Github over port 22. Here is the log:</p>
  <pre><code>11:20:17.116821 trace.c:375             setup: git_dir: .git
  11:20:17.116867 trace.c:376             setup: git_common_dir: .git
  11:20:17.116872 trace.c:377             setup: worktree: /home/user/code/test
  11:20:17.116874 trace.c:378             setup: cwd: /home/user/code/test
  11:20:17.116877 trace.c:379             setup: prefix: (null)
  11:20:17.116879 git.c:439               trace: built-in: git remote show test
  11:20:17.117075 run-command.c:663       trace: run_command: unset GIT_PREFIX; 'ssh -vvv' git@ssh.github.com 'git-upload-pack '\''github-user/test.git'\'''
  OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f  31 Mar 2020
  debug1: Reading configuration data /home/user/.ssh/config
  debug1: Reading configuration data /etc/ssh/ssh_config
  debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
  debug1: /etc/ssh/ssh_config line 21: Applying options for *
  debug2: resolving &quot;ssh.github.com&quot; port 22
  debug2: ssh_connect_direct
  debug1: Connecting to ssh.github.com [140.82.121.35] port 22.
  debug1: Connection established.
  debug1: identity file /home/user/.ssh/id_rsa type -1
  debug1: identity file /home/user/.ssh/id_rsa-cert type -1
  debug1: identity file /home/user/.ssh/id_dsa type -1
  debug1: identity file /home/user/.ssh/id_dsa-cert type -1
  debug1: identity file /home/user/.ssh/id_ecdsa type -1
  debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
  debug1: identity file /home/user/.ssh/id_ecdsa_sk type -1
  debug1: identity file /home/user/.ssh/id_ecdsa_sk-cert type -1
  debug1: identity file /home/user/.ssh/id_ed25519 type -1
  debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
  debug1: identity file /home/user/.ssh/id_ed25519_sk type -1
  debug1: identity file /home/user/.ssh/id_ed25519_sk-cert type -1
  debug1: identity file /home/user/.ssh/id_xmss type -1
  debug1: identity file /home/user/.ssh/id_xmss-cert type -1
  debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
  </code></pre>
  <p>As you can see, it completely skips over the <code>~/.ssh/config</code> definitions. Even if I specify it in the ssh command, it ignores it. Which is what leads me to believe I have some misunderstanding about how <code>host</code> and <code>hostname</code> works, or there is some unspoken behavior, that causes this.</p>
  <p>I have also used <code>ssh -vvvT &lt;remote&gt;</code> to get the most verboseness possible, and like mentioned earlier, normal ssh works completely fine. Regardless of where I am in the directory tree when the command is run, regardless of which <code>host</code> I'm calling, it works perfectly fine. Which is why I'm confused because it doesn't work when <code>git</code> is involved in the process.</p>
  <p>There is also only OpenSSH installed, so it shouldn't be a conflicting ssh client I'd assume.</p>
  <p>For now, I get by with simply adding an <code>sshCommand</code> per repo <code>git</code> config, however, by doing this there is little point in actually having an ssh config when it isn't used for much since Github doesn't support shell access and on work my machine isn't used for any other proper ssh-ing at the moment.</p>
  <p>I've been scratching my head over this for the last two weeks or so, but I've half given up and decided to at least try posting a question about this since the others like this ones like this one (in title at least) have not solved my issue. Hopefully someone here knows what is wrong and can tell me how to fix it or at least point me towards some documentation or something that explains what I'm doing wrong.</p>