devtools::install_github 因 CA 证书错误而失败 [英] devtools::install_github fails with CA cert error

查看:18
本文介绍了devtools::install_github 因 CA 证书错误而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试调用 install_github 时,我收到以下错误(不仅仅是这个包,而是所有 github 包):

When I try to call install_github, I get the following error (not just for this package, but for all github packages):

> install_github('ramnathv/slidify')
Downloading github repo ramnathv/slidify@master
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the SSL CA cert (path? access rights?)

但是如果我直接使用 RCurl 用 ssl 访问 github 就没有问题了:

But if I use RCurl directly to access github with ssl, I don't get any problem:

>  x <- getBinaryURL(
          url='https://github.com/ramnathv/slidify/archive/master.zip',
          followlocation=1L
          )

正常工作,因此 RCurl 可以正确验证 SSL 证书并下载存档文件.

works with no errors, so RCurl can verify the SSL certificate properly and download the archive file.

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8    
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
 [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RCurl_1.95-4.7 bitops_1.0-6   devtools_1.8.0

loaded via a namespace (and not attached):
 [1] httr_1.0.0      R6_2.1.0        magrittr_1.5    rversions_1.0.2
 [5] tools_3.2.1     curl_0.9.1      Rcpp_0.12.0     memoise_0.2.1  
 [9] xml2_0.1.1      stringi_0.5-5   git2r_0.10.1    stringr_1.0.0  
 [13] digest_0.6.8   

> curlVersion()

$age
[1] 3

$version
[1] "7.38.0"

$vesion_num
[1] 468480

$host
[1] "x86_64-pc-linux-gnu"

$features
   ipv6         ssl        libz        ntlm   asynchdns      spnego 
      1           4           8          16         128         256 
   largefile         idn tlsauth_srp     ntlm_wb 
    512        1024       16384       32768 

$ssl_version
[1] "OpenSSL/1.0.1k"

$ssl_version_num
[1] 0

$libz_version
[1] "1.2.8"

$protocols
[1] "dict"   "file"   "ftp"    "ftps"   "gopher" "http"   "https"  "imap"  
[9] "imaps"  "ldap"   "ldaps"  "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp"   
[17] "sftp"   "smtp"   "smtps"  "telnet" "tftp"  

$ares
[1] ""

$ares_num
[1] 0

$libidn
[1] "1.29"

如果我使用 httr::set_config( httr::config( ssl_verifypeer = 0L ) ) 那么我可以成功运行 install_github 但我更愿意实际检查 ssl 证书.

If I use httr::set_config( httr::config( ssl_verifypeer = 0L ) ) then I can successfully run install_github but I would prefer to actually check ssl certificates.

谁能提供解决方案?

推荐答案

终于想通了.

我安装了两个不同的 ssl 库,出于某种原因,针对 libcurl4-openssl-dev 构建的 RCurl 包和针对 libcurl4-nss-dev 构建的 curl 包,但我只安装了 openssl 的 CA 密钥,而不是 nss.

I had two different ssl libraries installed and for some reason, the RCurl package built against libcurl4-openssl-dev and the curl package built against libcurl4-nss-dev, but I had only installed CA keys for openssl, not for nss.

我用 R 中的 remove.packages('curl') 解决了我的问题,然后退出 R 并从 shell apt-get remove libcurl4-nss-dev 开始R 和 install.packages('curl')

I solved my problem with remove.packages('curl') in R and then quitting R and from the shell apt-get remove libcurl4-nss-dev starting R and install.packages('curl')

我的错误导致了我的问题,是使用 RCurl 而不是 httrcurl 测试 SSL CA 处理,这将让我很快发现我的 curl 包链接到了错误的 SSL 库.

My mistake, which led to my question, was to test the SSL CA handling using RCurl instead of httr or curl, which would have led me quickly to the fact that my curl package was linked to the wrong SSL library.

这篇关于devtools::install_github 因 CA 证书错误而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆