git clone ssh 时出现 fatal: Could not read from remote repository

一、问题及解决办法:

在 ubuntu 中,要把 GitHub 上的储存库克隆到计算机上时,执行如下命令:

git clone [email protected]:USER-NAME/REPOSITORY-NAME.git

有时候会出现提示,并且无法顺利 clone 所需文件:
fatal: Could not read from remote repository

这时候可以转用 https,即不用 GitHub 上的 ssh,而用 https。

git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

二、ssh 和 https 的区别:

  • ssh:使用 SSH 协议,您可以连接到远程服务器和服务并进行身份验证。使用 SSH 密钥,您可以连接到 GitHub,而无需在每次访问时都提供用户名或密码。
  • https:每次都需要输入账号与密码。

三、更详细的说明请看相关文档:

猜你喜欢

转载自www.cnblogs.com/lonelyWMW/p/11615734.html