Git日常错误
214字小于1分钟
2024-12-02
问题一:
提示:ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.
Please make sure you have the correct access rights
转载:https://blog.csdn.net/qq_36157085/article/details/135763782
检查是否能连接成功
ssh -T git@github.com
提示错误
ssh: connect to host github.com port 22: Connection timed out
在C盘/用户/用户名/.ssh
中创建 config
文件(没有任何后缀)
编辑该文件,输入
# github
Host github.com
# github邮箱
User xxxxxx@qq.com
HostName ssh.github.com
PreferredAuthentications publickey
# 指定ssh私钥文件
IdentityFile ~/.ssh/github
# 修改连接端口
Port 443
再次检查是否能正常连接
ssh -T git@github.com
会出现以下提示,输入 yes 回车即可
The authenticity of host '[ssh.github.com]:443 ([192.30.255.123]:443)' can't be established.
RSA key fingerprint is SHA256:xxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.255.123]:443' (RSA) to the list of known hosts.
即可正常上传