GitHub: Permission denied (publickey). fatal: Could not read from remote repository

  1. Generate SSH key using ssh-keygen -t rsa -b 4096 -C "your email".
  2. Copy the output of cat ~/.ssh/id_rsa.pub to your clipboard
  3. Paste the above-copied output to the form at https://github.com/settings/ssh/new
  4. Then go ahead to retry the operation that generated the initial fatal error.

Update: If you are still facing “ssh: connect to host github.com port 22: Connection timed out”, then follow the below steps.

Check the connection, mostly it will time out

$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out

Check the same by providing optional param port

$ ssh -T -p 443 git@ssh.github.com
Hi <user_name>! You've successfully authenticated, but GitHub does not provide shell access.

Update the SSH settings

$ vim ~/.ssh/config
# Add github in the know hosts
Host github.com
  Hostname ssh.github.com
  Port 443

Check the connection, mostly it will connect this time

$ ssh -T git@github.com
Hi <user_name>! You've successfully authenticated, but GitHub does not
provide shell access.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)