git clone 出错

在 linux 环境下,(我用的是虚拟机 virtualbox,ubuntu 16.04)


以下错误是已经在远程仓库添加了对应的 SSH 的情况下出现的:

错误1、 出现 fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack failed

git config http.postBuffer 524288000
不过这个方法也并不总是好使,一般情况下是因为空间不足引起的,所以这样可以解决;
不排除其他情况引起同样的报错。

错误2、有时候 git clone 在普通模式下,就算使用 sudo 还是会报错:

packet_write_wait: Connection to 104.192.143.1 port 22: Broken pipe
fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack failed

或者

Permission denied (publickey). (PS:再次强调已正确添加过SSH,还是出现这样的错)
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这时候su进入root模式,然后再克隆或许可以解决。

3、有时候用尽各种办法,由于SSH的种种原因,还是会导致克隆失败,

最后的是使用 https 协议来克隆,(eg:git clone https://github.com/wdnlwzd/movie-comment.git)

克隆下来过后,由于是使用https克隆的,所以每次操作都需要输入密码,
不过好在也不是没有解决办法:
在克隆下来的仓库的 .ssh/config,把config文件下的 url(这时是一个 https 链接)改为对应的ssh链接(eg:
git clone [email protected]:wdnlwzd/movie-comment.git )。

Ok,这样之后就可以像之前那样使用ssh来操作仓库了。

PS: 如果用 https 形式 clone 也不好使,那真要找找网络、代理是否有问题了。

你可能感兴趣的:(Linux,Else)