ssh: connect to host github.com port 22: Connection refusedfatal: Could not read from remote reposi

When executing git commands such as: git clone, git pull, etc.

出现报错:ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

The problem is mainly in the ssh key, which needs to be reset and added to git

open cmd

 

input the command

ssh-keygen -t rsa -C "您的email"

Enter all the way, when encountering (y/n) select  y

Two SSH key pairs are generated under the user's .ssh, id_rsa is the private key, which cannot be leaked out, and id_rsa.pub is the public key, which can be safely told to anyone. Generally view under the c drive

Write picture description here

 Go to git to set the key

1.

 2. Open the local id_rsa.pub (public key) and copy the content into it

 

After the github configuration is complete, the code can be pushed.

Guess you like

Origin blog.csdn.net/slow097/article/details/125558111