在R中使用git2r :: clone进行SSH身份验证时,获取“不受支持的URL协议" [英] Getting `unsupported URL protocol` when using SSH authentication with git2r::clone in R

查看:81
本文介绍了在R中使用git2r :: clone进行SSH身份验证时,获取“不受支持的URL协议"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过R在中通过SSH (不是HTTPS协议)通过git2r :: clone克隆私有仓库.

I'm trying to clone a private repo with git2r::clone via SSH (not HTTPS protocol) in R by doing

git2r::clone("git@git.server.com:team_name/repo_name.git", "~/dev/")

但是,我不断得到

Error in 'git2r_clone': unsupported URL protocol

有什么问题吗?

我已通过SSH通过回购进行身份验证,并可以在命令行中使用与git clone url相同的URL进行克隆.我想避免使用https并将我的凭据输入URL.

I am authenticated to the repo via SSH and can clone using the same URL in the command line with git clone url. I would like to avoid using https and entering my credentials into the URL.

我确保每个推荐答案

如果您的git2r安装不支持SSH,因此无法解析git SSH URL,则会发生这种情况.

This can happen if your git2r installation does not support SSH and therefore can't parse git SSH URLs.

您可以通过运行进行确认 libgit2_features() in R.

You can confirm by running libgit2_features() in R.

如果禁用SSH,您将看到

If SSH is disabled, you will see

$threads
[1] TRUE

$https
[1] TRUE

$ssh
[1] FALSE

要解决此问题,请确保已安装libssh2libgit2.就我而言,我有libssh2,但是我仍然缺少libgit2.在Mac上,您可以

To fix this, make sure you have installed libssh2 and libgit2. In my case, I had libssh2, but I was still missing libgit2. On a Mac, you can do

brew install libssh2brew install libgit2.

在那之后,使用

install.packages("git2r", type="source", configure.vars="autobrew=yes")

library(git2r)重新加载git2r.现在,如果您在R中运行libgit2_features(),您应该会看到ssh TRUE

Reload git2r with library(git2r). Now if you run libgit2_features() in R, you should see ssh TRUE

这篇关于在R中使用git2r :: clone进行SSH身份验证时,获取“不受支持的URL协议"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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