git连接远程仓库失败

433 阅读1分钟

1.建立本地仓库

2.添加公钥

3.建立远程仓库

4.本地仓库连接远程仓库

5.测试连接情况

6.问题

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

///解决1
//设置git安装目录下的ssh_config
//F:\git\Git\etc\ssh
Host gitee.com
     User git
     Hostname gitee.com
     PreferredAuthentications publickey
     IdentityFile ~/.ssh/id_rsa
     Port 443
 //结果失败
 提示:ssh: connect to host gitee.com port 443: Connection timed out

7.问题来源

//当ping gitee.com时显示

C:\Users\F1685683>ping gitee.com
Ping gitee.com [153.3.137.123] (使用 32 位元組的資料):
要求等候逾時。
要求等候逾時。
要求等候逾時。
要求等候逾時。
153.3.137.123 的 Ping 統計資料:
    封包: 已傳送 = 4,已收到 = 0, 已遺失 = 4 (100% 遺失),

//再设置
找到hosts文件目录 C:\Windows\System32\drivers\etc
修改hosts,添加 153.3.137.123 gitee.com
//结果:还是连接不通