gitee仓库ssh方式无法连接时可能的一种情况

66 阅读1分钟

问题背景: MacOS上使用sourcetree提交代码到gitee仓库时,突然一直提示下图中的问题

347691673317504_.pic.jpg

git -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch gitee 
kex_exchange_identification: Connection closed by remote host

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Completed with errors, see above

找了一圈文档并没有解决,最后在本地的 hosts 文件中发现有一条 gitee.com 的记录,

/private/etc/hosts

hosts.png

删掉后发现就能正常访问了。 (尝试之前请先备份hosts文件)