Custom SSH Config Not Working

10,317

You wrote:

 Host github.com
   HostName ssh.github.com
   Port 443

But didn't use it:

 ssh -T [email protected]

You need to

 ssh -T [email protected]

to use the github.com host you defined.

Share:
10,317
Neo
Author by

Neo

Updated on June 07, 2022

Comments

  • Neo
    Neo almost 2 years

    I have been trying to get ssh to connect to Github using port 443 and I have decided to use a custom ssh config file at ~/.ssh/config. After creating the file and setting the proper file permissions I attempt to connect again, the connection is still timing out on port 22. I know this because port 22 is blocked by my ISP (for some strange reason).

    $ cd ~/.ssh
    $ touch config
    $ chown $USER config
    $ chmod 644 config
    

    Then in the config file I add this:

    Host pagodabox.io
      HostName git.pagodabox.io
      Port 443
    
    Host github.com
      HostName ssh.github.com
      Port 443
    

    Then I attempt to call this from my iTerm app.

    $ ssh -T [email protected]
    

    I get the error:

    ssh: connect to host ssh.github.com port 22: Operation timed out fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

    However, if I do this

    $ ssh -T -p 443 [email protected] 
    

    I get the desired response.

    Hi [Username]! You've successfully authenticated, but GitHub does not provide shell access.

    I am using oh-my-zsh FWIW. Why is this happening? I have rebooted my mac also. Still the file doesn't seem to be recognised