1,安装git:

访问链接:Git for Windows,单击Download下载后安装,非常简单,网上有很多教程

我参考的这篇讲解的非常详细:(8条消息) Git 详细安装教程(详解 Git 安装过程的每一个步骤)_mukes的博客

2,克隆演示项目 cypress-example-recipes

#命令行方式下进入要安装Cypress演示项目的文件夹下(我的路径最好不要参考哈)
C:\Users\登登登登>cd CypressProject
C:\Users\登登登登\CypressProject>
#克隆演示项目
C:\Users\登登登登\CypressProject>git clone https://github.com/cypress-io/cypress-example-recipes.git

此时代码报错(错误信息):

fatal:unable to access 'https://github.com/cypress-io/cypress-example-recipes.git/': OpenSSL SSL_read: Connection was reset, errno 10054

 

网上查找了一些解决办法:

 

第一步:查看是否是github网站上不去

cmd 命令提示符中输入 ping github.com   显示如下:

C:\Users\登登登登>ping github.com

正在 Ping github.com [13.229.188.59] 具有 32 字节的数据:
请求超时。
请求超时。
请求超时。
请求超时。

13.229.188.59 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 0,丢失 = 4 (100% 丢失),

ping不通,可能是本地DNS无法解析导致的

 

打开C:\Windows\System32\drivers\etc\hosts,发现确实没有github.com的解析,末尾添加内容:

192.30.255.112  github.com git 
185.31.16.184 github.global.ssl.fastly.net

 

重启cmd窗口,继续ping一下github.com:

C:\Users\登登登登>ping github.com

正在 Ping github.com [192.30.255.112] 具有 32 字节的数据:
来自 192.30.255.112 的回复: 字节=32 时间=267ms TTL=44
来自 192.30.255.112 的回复: 字节=32 时间=245ms TTL=44
来自 192.30.255.112 的回复: 字节=32 时间=253ms TTL=44
来自 192.30.255.112 的回复: 字节=32 时间=245ms TTL=44

192.30.255.112 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 245ms,最长 = 267ms,平均 = 252ms

C:\Users\登登登登>

此时已经可以ping成功了,说明本机已经能够正常解析github.com这个域名了。

 

再次尝试git clone 命令,再次出现如下错误:

fatal:unable to access 'https://github.com/cypress-io/cypress-example-recipes.git/': OpenSSL SSL_read: Connection was reset, errno 10054

此时分析,可能是服务器的SSL证书没有经过第三方机构的签署,所以才报错

 

再次参考网上解决办法:解除ssl验证后,再次git即可

git config --global http.sslVerify "false"

C:\Users\登登登登\CypressProject>git config --global http.sslVerify "false"
C:\Users\登登登登\CypressProject>git clone https://github.com/cypress-io/cypress-example-recipes.git
Cloning into 'cypress-example-recipes'...
fatal: unable to access 'https://github.com/cypress-io/cypress-example-recipes.git/': Failed to connect to github.com port 443 after 21037 ms: Timed out

此时系统仍然报错,仔细观察发现,与之前错误已经不同,错误原提示为Time out

 

再次尝试:也会有中途断连情况,但是多试两次还是可以成功的

C:\Users\登登登登\CypressProject>git clone https://github.com/cypress-io/cypress-example-recipes.git
Cloning into 'cypress-example-recipes'...
remote: Enumerating objects: 13960, done.
remote: Counting objects: 100% (3229/3229), done.
remote: Compressing objects: 100% (1618/1618), done.
error: 4019 bytes of body are still expectedMiB | 16.00 KiB/s
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

C:\Users\登登登登\CypressProject>git clone https://github.com/cypress-io/cypress-example-recipes.git
Cloning into 'cypress-example-recipes'...
remote: Enumerating objects: 13960, done.
remote: Counting objects: 100% (3229/3229), done.
remote: Compressing objects: 100% (1618/1618), done.
remote: Total 13960 (delta 1925), reused 2503 (delta 1352), pack-reused 10731
Receiving objects: 100% (13960/13960), 45.44 MiB | 2.68 MiB/s, done.

至此,项目已经安装成功啦

cypress编写教程_github