🐾   [Git] connect to host github.com port 22: Operation timed out 해결 방안

배경

git pull 를 하려고 하는 에러 메시지가 떴다. 그래서 github 가서 ssh 키를 다시 등록을 했는데도 해결이 되지 않았다.

원인

카페나 제3의 장소에서 사용할 때 보안때문에 발생하는 문제 같다.

에러 메시지

ssh: connect to host 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.

해결 방안

  1. 터미널에서 명령어를 친다
vim ~/.ssh/config
  1. i를 누른다
  2. 아래 내용을 친다
Host github.com
Hostname ssh.github.com
Port 443
User git
  1. esc를 누르고 :wq 입력해서 저장한다.
  2. 그리고 git 명령어를 친다 ( 예를 들어서 git pull a main)
  3. 아래 글이 나오고 연결할 건지 물어본다. yes를 입력한다
    The authenticity of host '[ssh.github.com]:443 ([아이피주소]:443)' can't be established.
    ED25519 key fingerprint is SHA256: ...
    This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:1: github.com

    Are you sure you want to continue connecting (yes/no/[fingerprint])?

  4. 그럼 끝!!!

참조

https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

​ ​ ​