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

I have had this same problem the solution was edit ~/.ssh/config e put this lines:

Host github.com
  Hostname ssh.github.com
  Port 443

That indicates that the git software cannot connect to Github through SSH: this often happens if your firewall, or the firewall set up by your ISP, blocks SSH connections on port 22. A quick workaround to see if this is the problem is to try the HTTPS URL provided by Github:

git remote add origin-https https://github.com/alicht/tweetanuber.git
git push -u origin-https master

If that works, then it's definitely your SSH port being closed. You could continue to use this alternate syntax, try to get port 22 unblocked on your computer or at your ISP, or check out the suggestion at https://stackoverflow.com/a/8081292/27310 and see if that works for you.


The reason could be the firewall modification as you are under a network.(In which case they may deliberately block some ports): Which in my case I'm on the library and the firewall is blocking. For this work's do on terminal:

git config --local -e

and change this(using vim you need to type the keyboard 'i' for insert):

 url = [email protected]:username/repo.git

for this:

url = https://github.com/username/repo.git

Then for save(type the keyboard ESC and then type wq! and Enter).

Then try to push again.

Tags:

Git

Github