本文主要是介绍Yocto - 解决Clone失败的问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在Yocto的Project Quick Build文档里,使用的是下面命令clone仓库:(Yocto Project Quick Build — The Yocto Project ® 4.3.999 documentation)
$ git clone git://git.yoctoproject.org/poky
但可能由于环境原因或其他原因,一直显示连接失败,应该是git协议支持问题,要么服务器支持有问题,要么本地支持有问题。
Cloning into 'poky'...
fatal: unable to connect to git.yoctoproject.org:
git.yoctoproject.org[0: 198.145.29.87]: errno=Connection timed out
然后换成https:
git clone https://git.yoctoproject.org/poky
这样的话,在两台机器上,一台就可以,一台还是有问题。
Error信息:
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
基本原因是您的电脑不信任签署 Git 服务器所用证书的证书颁发机构。这并不意味着证书可疑,但它可能是自签名的,或者是由不在操作系统 CA 列表中的机构/公司签名的。如果你没有任何理由对该证书产生怀疑,那么你要做的就是告诉电脑信任该证书,以规避电脑上的问题。
你需要检查用于 git服务器的网络证书,并将其添加到 </git_installation_folder>/bin/curl-ca-bundle.crt 中。
The basic reason is that your computer doesn't trust the certificate authority that signed the certificate used on the Git server. This doesn't mean the certificate is suspicious, but it could be self-signed or signed by an institution/company that isn't in the list of your OS's list of CAs. What you have to do to circumvent the problem on your computer is telling it to trust that certificate - if you don't have any reason to be suspicious about it.
You need to check the web certificate used for your git server, and add it to your </git_installation_folder>/bin/curl-ca-bundle.crt.
可以在不检查上述证书的情况下运行,可以设置:
export GIT_SSL_NO_VERIFY=1
#or
git config --global http.sslverify false
如果要添加证数,则运行下面命令:
hostname=XXX
port=443
trust_cert_file_location=`curl-config --ca`
sudo bash -c "echo -n | openssl s_client -showcerts -connect $hostname:$port -servername $hostname \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
>> $trust_cert_file_location"
curl-config --ca 这个命令是用来识别curl-ca-bundle.crt这个文件的地址的,如果没有安装curl-config命令,则需要安装一下相关package。
port 443就是https服务。
我是直接运行git config --global http.sslverify false就可以clone代码了。
另外,有一种推荐是不使用Yocto网站的仓库,而是用github的:
GitHub - yoctoproject/poky: Mirror of https://git.yoctoproject.org/poky/.
参考:
1, StackOverflow
ubuntu - Unable to clone Yocto Poky - Stack Overflow
Server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none - Stack Overflow
这篇关于Yocto - 解决Clone失败的问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!