Ssh: connect to host github.com port 22: Permission denied

Hi,
I am trying to clone/pull/push from my private repository without a success.
I already tried to create a new SSH key multiple times
I keep getting this error: ssh: connect to host github.com port 22: Permission denied

$ git clone git@github.com:LinnCohen/FlightGear_PTM.git
Cloning into 'FlightGear_PTM'...
ssh: connect to host github.com port 22: Permission denied
fatal: Could not read from remote repository.

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

I would like to mention that I worked with this repository and others a month ago, and suddenly it stopped working…

I also tried this command: ssh -vT git@github.com
and gets this error:

$ ssh -vT git@github.com
OpenSSH_8.2p1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /c/Users/lcohen/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.121.4] port 22.
debug1: connect to address 140.82.121.4 port 22: Permission denied
ssh: connect to host github.com port 22: Permission denied

I appreciate any help
Thank you.

:wave: Welcome!

This error is usually because a firewall or proxy is blocking the ssh connection at port 22.

I recommend trying the troubleshooting here:

Thank you for the quick reply!
I tried to do the same as you sent me, but I got a new issue with that:
kex_exchange_identification: Connection closed by remote host

$ git clone git@github.com:LinnCohen/FlightGear_PTM.git
Cloning into 'FlightGear_PTM'...
kex_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

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

using the ssh -vT git@github.com command gave me that:

OpenSSH_8.2p1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /c/Users/lcohen/.ssh/config
debug1: /c/Users/lcohen/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ssh.github.com [140.82.121.35] port 443.
debug1: Connection established.
debug1: identity file /c/Users/lcohen/.ssh/id_rsa type 0
debug1: identity file /c/Users/lcohen/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_dsa type -1
debug1: identity file /c/Users/lcohen/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/lcohen/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/lcohen/.ssh/id_xmss type -1
debug1: identity file /c/Users/lcohen/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2
debug1: kex_exchange_identification: banner line 0: HTTP/1.0 500 handshakefailed
debug1: kex_exchange_identification: banner line 1: Content-Type: text/html
debug1: kex_exchange_identification: banner line 2: Cache-Control: no-cache
debug1: kex_exchange_identification: banner line 3: Content-Length: 3936
debug1: kex_exchange_identification: banner line 4: X-Frame-Options: deny
debug1: kex_exchange_identification: banner line 5: Proxy-Connection: Close
debug1: kex_exchange_identification: banner line 6:
debug1: kex_exchange_identification: banner line 7: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
debug1: kex_exchange_identification: banner line 8: <html>
debug1: kex_exchange_identification: banner line 9: <!-- FileName: index.html
debug1: kex_exchange_identification: banner line 10:      Language: [en]
debug1: kex_exchange_identification: banner line 11: -->
debug1: kex_exchange_identification: banner line 12: <!--Head-->
debug1: kex_exchange_identification: banner line 13: <head>
debug1: kex_exchange_identification: banner line 14:   <meta http-equiv="X-UA-Compatible" content="IE=7" />
debug1: kex_exchange_identification: banner line 15:   <meta content="text/html http-equiv="Content-Type">
debug1: kex_exchange_identification: banner line 16:   <title>McAfee Web Gateway - Notification</title>
debug1: kex_exchange_identification: banner line 17:   <script src="/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/javascript/sw.js" type="text/javascript" ></script>
debug1: kex_exchange_identification: banner line 18:   <link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/stylesheet.css" />
debug1: kex_exchange_identification: banner line 19: </head>
debug1: kex_exchange_identification: banner line 20: <!--/Head-->
debug1: kex_exchange_identification: banner line 21: <!--Body-->
debug1: kex_exchange_identification: banner line 22: <body onload="swOnLoad();">
debug1: kex_exchange_identification: banner line 23:   <table class='bodyTable'>
debug1: kex_exchange_identification: banner line 24:     <tr>
debug1: kex_exchange_identification: banner line 25:       <td class='bodyData' background='/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/bg_body.gif'>
debug1: kex_exchange_identification: banner line 26: <!--Logo-->
debug1: kex_exchange_identification: banner line 27: <table class='logoTable'>
debug1: kex_exchange_identification: banner line 28:   <tr>
debug1: kex_exchange_identification: banner line 29:     <td class='logoData'>
debug1: kex_exchange_identification: banner line 30:       <a href='http://www.mcafee.com'>
debug1: kex_exchange_identification: banner line 31:         <img src='/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/logo_mwg.png'></a>
debug1: kex_exchange_identification: banner line 32:     </td>
debug1: kex_exchange_identification: banner line 33:   </tr>
debug1: kex_exchange_identification: banner line 34: </table>
debug1: kex_exchange_identification: banner line 35: <!--/Logo-->
debug1: kex_exchange_identification: banner line 36: <!--Contents-->
debug1: kex_exchange_identification: banner line 37: <!-- FileName: handshakefailed.html
debug1: kex_exchange_identification: banner line 38:      Language: [en]
debug1: kex_exchange_identification: banner line 39: -->
debug1: kex_exchange_identification: banner line 40: <!--Title-->
debug1: kex_exchange_identification: banner line 41: <table class='titleTable' background='/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/bg_navbar.jpg'>
debug1: kex_exchange_identification: banner line 42:   <tr>
debug1: kex_exchange_identification: banner line 43:     <td class='titleData'>
debug1: kex_exchange_identification: banner line 44:       Handshake failed.
debug1: kex_exchange_identification: banner line 45:     </td>
debug1: kex_exchange_identification: banner line 46:   </tr>
debug1: kex_exchange_identification: banner line 47: </table>
debug1: kex_exchange_identification: banner line 48: <!--/Title-->
debug1: kex_exchange_identification: banner line 49:
debug1: kex_exchange_identification: banner line 50: <!--Content-->
debug1: kex_exchange_identification: banner line 51: <table class="contentTable">
debug1: kex_exchange_identification: banner line 52:   <tr>
debug1: kex_exchange_identification: banner line 53:     <td class="contentData">
debug1: kex_exchange_identification: banner line 54:       The SSL handshake could not be performed
debug1: kex_exchange_identification: banner line 55:     </td>
debug1: kex_exchange_identification: banner line 56:   </tr>
debug1: kex_exchange_identification: banner line 57: </table>
debug1: kex_exchange_identification: banner line 58: <!--/Content-->
debug1: kex_exchange_identification: banner line 59:
debug1: kex_exchange_identification: banner line 60: <!--Info-->
debug1: kex_exchange_identification: banner line 61: <table class="infoTable">
debug1: kex_exchange_identification: banner line 62:   <tr>
debug1: kex_exchange_identification: banner line 63:     <td class="infoData">
debug1: kex_exchange_identification: banner line 64:       <b>Host: </b>140.82.121.35<br />
debug1: kex_exchange_identification: banner line 65:       <b>Reason: </b>error:1408F10B:SSL routines:ssl3_get_record:wrong version number:state 24:Application response 500 handshakefailed
debug1: kex_exchange_identification: banner line 66:     </td>
debug1: kex_exchange_identification: banner line 67:   </tr>
debug1: kex_exchange_identification: banner line 68: </table>
debug1: kex_exchange_identification: banner line 69: <!--/Info-->
debug1: kex_exchange_identification: banner line 70:
debug1: kex_exchange_identification: banner line 71: <!--/Contents-->
debug1: kex_exchange_identification: banner line 72: <!--Policy-->
debug1: kex_exchange_identification: banner line 73: <!--<table class='policyTable'>
debug1: kex_exchange_identification: banner line 74:   <tr>
debug1: kex_exchange_identification: banner line 75:     <td class='policyHeading'>
debug1: kex_exchange_identification: banner line 76:       <hr>
debug1: kex_exchange_identification: banner line 77:       Company Acceptable Use Policy
debug1: kex_exchange_identification: banner line 78:     </td>
debug1: kex_exchange_identification: banner line 79:   </tr>
debug1: kex_exchange_identification: banner line 80:   <tr>
debug1: kex_exchange_identification: banner line 81:     <td class='policyData'>
debug1: kex_exchange_identification: banner line 82:     </td>
debug1: kex_exchange_identification: banner line 83:   </tr>
debug1: kex_exchange_identification: banner line 84: </table>-->
debug1: kex_exchange_identification: banner line 85: <!--/Policy-->
debug1: kex_exchange_identification: banner line 86: <!--Foot-->
debug1: kex_exchange_identification: banner line 87: <table class='footTable'>
debug1: kex_exchange_identification: banner line 88:   <tr>
debug1: kex_exchange_identification: banner line 89:  <td class='helpDeskData' background='/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/bg_navbar.jpg'>
debug1: kex_exchange_identification: banner line 90:       For assistance, please contact the InfoSec team by submitting this <a href="https://mcafeeprod.service-now.com/ITServices?id=sc_cat_item&sys_id=68f9dac3dbecef40e907572e5e96196f
debug1: kex_exchange_identification: banner line 91: "><font color="FFFF00">form</font></a>.  
debug1: kex_exchange_identification: banner line 92:     </td>
debug1: kex_exchange_identification: banner line 93:   </tr>
debug1: kex_exchange_identification: banner line 94:   <tr>
debug1: kex_exchange_identification: banner line 95:     <td class='footData'>
debug1: kex_exchange_identification: banner line 96: <!-- CA Cert Check
debug1: kex_exchange_identification: banner line 97: Please define a URL for User-Defined.Certificate.Authority.URL
debug1: kex_exchange_identification: banner line 98: -->
debug1: kex_exchange_identification: banner line 99:
debug1: kex_exchange_identification: banner line 100: <script>
debug1: kex_exchange_identification: banner line 101:
debug1: kex_exchange_identification: banner line 102: function caCert(){
debug1: kex_exchange_identification: banner line 103:
debug1: kex_exchange_identification: banner line 104: document.getElementById("caFooter").innerHTML ='<img style="vertical-align: middle;" src="/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/icon_cacert.gif"/> CA Certificate not installed. '
debug1: kex_exchange_identification: banner line 105:
debug1: kex_exchange_identification: banner line 106: }
debug1: kex_exchange_identification: banner line 107:
debug1: kex_exchange_identification: banner line 108: </script>
debug1: kex_exchange_identification: banner line 109:
debug1: kex_exchange_identification: banner line 110: <div id="caFooter" style="text-align:left;" >
debug1: kex_exchange_identification: banner line 111:
debug1: kex_exchange_identification: banner line 112: <img style="vertical-align: middle;" src="/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/img/icon_cacert.gif" onerror="caCert()"/> CA Certificate installed.
debug1: kex_exchange_identification: banner line 113: </div>
debug1: kex_exchange_identification: banner line 114: <!-- CA Cert Download -->
debug1: kex_exchange_identification: banner line 115: <div id="caFooter" style="text-align:left;" >
debug1: kex_exchange_identification: banner line 116: <a href="https://mcp.webwasher.com/mwg-internal/de5fs23hu73ds/$UmifKTu3pr658xMsuSqgKQxL6UuAkdJCvc0Ovqrvws0,/files/default/certs/MWG-InfoSec-SSL-CA.crt">Click here to download the CA Certificate.</a>
debug1: kex_exchange_identification: banner line 117: </div>
debug1: kex_exchange_identification: banner line 118: <!-- /CA Cert Download -->
debug1: kex_exchange_identification: banner line 119: <!-- /CA Cert Check -->
debug1: kex_exchange_identification: banner line 120:       generated <span id="time">2020-12-25 11:51:48</span> by MWG: fra-237-68, IP 0.0.0.0, ProxyPort: 0
debug1: kex_exchange_identification: banner line 121: Client IP: 176.229.186.148, RuleName: Default Allow, User: lcohen,AuthProto: SWPS
debug1: kex_exchange_identification: banner line 122:       <br />
debug1: kex_exchange_identification: banner line 123:      User-Agent
debug1: kex_exchange_identification: banner line 124:     </td>
debug1: kex_exchange_identification: banner line 125:   </tr>
debug1: kex_exchange_identification: banner line 126: </table>
debug1: kex_exchange_identification: banner line 127: <!--/Foot-->
debug1: kex_exchange_identification: banner line 128:       </td>
debug1: kex_exchange_identification: banner line 129:     </tr>
debug1: kex_exchange_identification: banner line 130:   </table>
debug1: kex_exchange_identification: banner line 131: </body>
debug1: kex_exchange_identification: banner line 132: <!--/Body-->
debug1: kex_exchange_identification: banner line 133: </html>
kex_exchange_identification: Connection closed by remote host

Thank you for the reply,
This solution made a new problem: kex_exchange_identification: Connection closed by remote host

$ git clone git@github.com:LinnCohen/FlightGear_PTM.git
Cloning into 'FlightGear_PTM'...
kex_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

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

Can you help with that?