Git命令异常汇总

325 阅读1分钟
案例1:使用git拉取某个仓库时,遇到如下异常:
fatal: unable to access 'http://github.com/GNOME/find.git/': 
server certificate verification failed. CAfile: none CRLfile: none

根据错误提示,是安全证书的配置问题,可使用如下方式解决:

git config --global http.sslverify false 
git config --global https.sslverify false

关闭安全验证

案例2:添加submodule时,提示目录异常
$ git submodule add https://github.com/alibaba/MNN.git device/mobileNN/
fatal: 'device/mobileNN' already exists and is not a valid git repo

因为mobileNN目录已存在,导致添加失败,解决方法:删除mobileNN目录后,重新执行

$: git submodule add github.com/alibaba/MNN… device/mobileNN/MNN

Cloning into 'E:/yinsi/olearning/device/mobileNN/MNN'...

案例3:clone仓库时,出现ssl对的问题
fatal: Unsupported SSL backend ‘“openssl”’. Supported SSL backends:  
openssl

解决方案:

git config --global --unset http.sslBackend
案例4:clone仓库,error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)

解决方案:

git config --global http.version HTTP/1.1