尝试下载Ruby 1.9.2时,RVM遇到证书错误.看起来好像curl有证书问题,但我不知道如何绕过它.我在下面列出了确切的错误信息.
$ rvm install 1.9.2
Installing Ruby from source to: /Users/willdennis/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...
ruby-1.9.2-p180 - #fetching
ERROR: Error running 'bunzip2 '/Users/willdennis/.rvm/archives/ruby-1.9.2-p180.tar.bz2'', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/extract.log
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
Fetching yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/archives
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle" …Run Code Online (Sandbox Code Playgroud) 我喜欢github和RStudio的工作流程.最近,我创建了一个项目模板,它可以创建目录和脚本等,并希望在本地创建并推送到github.
在过去,我通过https://github.com/在RStudio中使用版本控制创建了一个项目的repo 来创建本地repo,然后转储我已经拥有的所有文件.
这似乎浪费时间.如何使用.Rproj文件获取已存在于RStudio中的目录/ repo并上传到github而不首先在https://github.com/上创建shell repo ?
我认为这可以节省工作流程的时间.
我想我可以按照方向-在 - 添加版本控制到项目下添加版本控制但这不允许我推送到github(也不应该因为RStudio如何知道你想要哪个git网站推到).
我正试图获得大量Twitter用户的追随者数量twitteR.发布的其他 许多问题对我这么做很有用,但就我所知,似乎没有一个与我的问题直接相关.
我可以将我的OAuth凭证注册到twitter R会话,但是我似乎根本无法做任何事情,我得到的是这条消息:
Error in function (type, msg, asError = TRUE) :
SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify fail
当我在twitteR不使用OAuth的情况下使用这些功能时,它们可以正常工作,没有任何错误或警告,但我遇到限制和受保护的帐户,我认为我可以避免使用OAuth.
以下是详细信息:
library(twitteR)
library(ROAuth)
library(RCurl)
#
# Here's how I register my credentials
#
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL = "https://api.twitter.com/oauth/access_token"
authURL = "https://api.twitter.com/oauth/authorize"
consumerKey = "------------"
consumerSecret = "-----------"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=requestURL,
accessURL=accessURL,
authURL=authURL)
download.file(url="http://curl.haxx.se/ca/cacert.pem",
destfile="cacert.pem")
twitCred$handshake(cainfo="cacert.pem")
To enable the connection, please direct …Run Code Online (Sandbox Code Playgroud) 我曾经问过一个非常相似的问题并得到了一个从命令行起作用的响应,但我现在想用R来自动化Windows的过程(Linux更容易).
这是我正在尝试做的事情:
我相信基于输出,我在失败之前一直到第5步(因为提交和本地目录中的文件永远不会转到云中的github).我知道第2步有效,因为这里创建了空仓库.我不知道如何测试第5步.在最后一步,shell(cmd6, intern = T)RGui和RStudio导致永恒的死亡螺旋.问题是:如何将提交和本地存储推送到云端.
这是我更新的代码(用户特定的唯一内容是第三代码块中的用户名和密码):
## Create Directory
repo <- "foo5"
dir.create(repo)
project.dir <- file.path(getwd(), repo)
## Throw a READ.ME in the directory
cat("This is a test", file=file.path(project.dir, "READ.ME"))
## Github info (this will change per user)
password <-"pass"
github.user <- "trinker"
## Get git location
test <- c(file.exists("C:/Program Files (x86)/Git/bin/git.exe"),
file.exists("C:/Program Files/Git/bin/git.exe"))
gitpath <- c("C:/Program Files (x86)/Git/bin/git.exe",
"C:/Program …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个函数来将项目推送到github而不首先在云中创建项目.目前,您可以使用此问题中的信息从RStudio中的git命令行执行此操作.
现在我正在尝试将其包装成一个函数,我可以使用它system从本地仓库创建云中的repo.我正在Windows和Linux机器上完成这个工作(所以不确定它在mac上的效果如何).这是我到目前为止的代码(检测git位置):
gitpath <- NULL
repo <- "New"
user <- "CantPostThat"
password <- "blargcats"
if (Sys.info()["sysname"] != "Windows") {
gitpath <- "git"
} else {
if (is.null(gitpath)){
test <- c(file.exists("C:\\Program Files (x86)\\Git\\bin\\git.exe"),
file.exists("C:\\Program Files\\Git\\bin\\git.exe"))
if (sum(test) == 0) {
stop("Git not found. Supply path to 'gitpath'")
}
gitpath <- c("\"C:\\Program Files (x86)\\Git\\bin\\git\"",
"\"C:\\Program Files\\Git\\bin\\git\"")[test][1]
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试用system:
system(paste(gitpath, "--version"))
> system(paste(gitpath, "--version"))
git version 1.7.11.msysgit.1
Run Code Online (Sandbox Code Playgroud)
看起来不错.但后来我尝试了一个真正的代码块:
cmd1 <- paste(gitpath, paste0("curl -u '", user, ":", …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习如何读入一个具有https url到r的访问/ zip文件.这是一个更大的映射学习项目的一部分我正在进行分支我在这里 发现的R技能(我将链接这篇文章)回到那里).
这是计划,但我从getURL得到一个错误,我不知道为什么:
require(RCurl)
NYSdemo <- getURL("https://reportcards.nysed.gov/zip/SRC2010.zip")
temp <- tempfile()
download.file(NYSdemo, temp)
data <- read.table(unz(temp, "a1.dat"))
unlink(temp)
Run Code Online (Sandbox Code Playgroud)
错误:
> NYSdemo <- getURL("https://reportcards.nysed.gov/zip/SRC2010.zip")
Error in function (type, msg, asError = TRUE) :
SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Run Code Online (Sandbox Code Playgroud)
就像我说这是一个学习项目所以我在这里使用的许多技术我都不熟悉.
我试图下载的实际zip文件是HERE
也许这实际上不是一个编程问题,但是URL不能使用getURL.
提前感谢您的想法和帮助.
编辑:我尝试了ssl.verifypeer但得到了另一个错误
> NYSdemo <- getURL("https://reportcards.nysed.gov/zip/SRC2010.zip",
+ ssl.verifypeer = FALSE)
Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) :
embedded nul in …Run Code Online (Sandbox Code Playgroud) 我有以下字符串我试图system在Win 7机器上传递.它应该.git在repo中创建目录但是使用system它不会(虽然类似的方法在Linux机器上工作,所以这是Windows特定的问题).
system( "cd C:/Users/trinker/Desktop/foo2 && \"C:\\Program Files (x86)\\Git\\bin\\git.exe\" init" )
Run Code Online (Sandbox Code Playgroud)
C:/Users/trinker/Desktop/foo2是回购的位置.C:\\Program Files (x86)\\Git\\bin\\git.exe是我的系统上的git的位置.
当我运行上面没有任何反应.没有消息,nadda.但是我cat是否在字符串上运行并将其直接粘贴到它运行的命令行中,提供以下消息并.git在适当的位置创建.
所以跑......
cat("cd C:/Users/trinker/Desktop/foo2 && \"C:\\Program Files (x86)\\Git\\bin\\git.exe\" init")
Run Code Online (Sandbox Code Playgroud)
将其粘贴到命令行中......
cd C:/Users/trinker/Desktop/foo2 && "C:\Program Files (x86)\Git\bin\git.exe" init
Run Code Online (Sandbox Code Playgroud)
给...
Initialized empty Git repository in C:/Users/trinker/Desktop/foo2/.git/
Run Code Online (Sandbox Code Playgroud)
......哪个好
所以我可以使用相同的字符串在R之外进行,但不能在R中.我需要对第一个字符串system做什么才能让它像我一样运行cat并粘贴到命令行中?答案很好,但我想知道这里发生了什么,所以我可以通过访问Windows命令行解决类似情况system.