error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
最终解决: 使用SSH和--depth = 1来增强功能
pod repo remove master
git clone --depth=1 git@github.com:CocoaPods/Specs.git ~/.cocoapods/repos/master
pod setup
如下图,可以获取CocoaPods仓库的HTTPS方式、抑或SSH方式地址:
![](https://img.haomeiwen.com/i2168300/2f82fc64890fbe93.png)
在使用Git拉取或提交文件时,如果走http的方式,文件太大会造成提交报错,这时就必须走SSH的方式
- 配置Git用户名和邮箱
git config user.name "用户名"
git config user.email "邮箱"
在config后加上 --global 即可全局设置用户名和邮箱,如果本机有多个项目,且Git仓库地址不一样,比如项目A仓库是Github上的,项目B仓库是公司的GitLab,由于它们的用户名和邮箱不一样,配置成全局后会造成另一个项目无法提交文件
- 生成ssh key
ssh-keygen -t rsa -C "邮箱"
然后根据提示连续回车即可在~/.ssh目录下得到id_rsa和id_rsa.pub两个文件,id_rsa.pub文件里存放的就是我们要使用的key。
- 上传key到github
复制key到剪贴板,或者使用cat查看复制
clip < ~/.ssh/id_rsa.pub
登录github
点击右上方的Accounting settings图标
选择 SSH key
点击 Add SSH key
- 测试是否配置成功
ssh -T git@github.com
配置成功会显示:
Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.
网友评论