- devtools::install_git Over SSH

- 此内容更新于:2016-02-02
主题:

我写一个R包,我保持一个SSH服务器上(裸)git存储库,并且我希望能够安装在本地机器上,而不需要手工克隆存储库。我尝试以下:但我得到的错误在Windows7的机器上,使用R3.1.2git2r版本0.11.0和devtools版本它1.9.1。任何帮助将不胜感激。谢谢!

原文:

I've written an R package that I keep in a (bare) git repository on an SSH server, and I want to be able to install it on a local machine without needing to clone the repository by hand.

I've attempted the following:

devtools::install_git("ssh://user_name@remote/path/to/repository")

but I get the error

    Downloading git repo ssh://user_name@remote/path/to/repository
    Error in git2r::clone(x$url, bundle, progress = FALSE) : 
    Error in 'git2r_clone': Failed to start SSH session: Unable to exchange encryption keys

I'm on a Windows 7 machine, using R 3.1.2, git2r version 0.11.0 and devtools version 1.9.1. Any help would be greatly appreciated. Thanks!

解决方案:
我遇到了这个问题。我知道这个问题有点旧,但是对于其他人遇到同样的问题(像我一样),这就是我发现的。问题可能你没有图书馆,(与使用的包)使用SSH通信。解决方案安装它。下面的例子假定Ubuntu。git2r使用图书馆叫LibSSH2启用运输/SSH。你可以使用你的包管理器安装如果你在Linux上。请注意如果你在Windows上,git2r不支持SSH协议:/在你安装LibSSH2git2r包你需要重新安装,使SSH运输(因为它的启用/禁用包构建)。GitHub来源问题:https://github.com/hadley/devtools/issues/796https://github.com/ropensci/git2r/issues/140我为什么需要LibSSH2吗?git没有使用它,对吧?你是对的!git并不使用它(据我所知)。然而,libgit2,纯Cgit2r使用gitAPI实现,。
原文:

Ran into this issue myself. I know this question is a bit old, but for anybody else running into the same issue (like me), here's what I've found.

The Problem

Likely you don't have the library that git2r (the package that devtools uses to interact with git) uses to communicate over SSH.

The Solution

Install it. The example below assumes Ubuntu.

sudo apt-get install libssh2-1 libssh2-1-dev

git2r uses a library called LibSSH2 to enable transport over SSH. You can install it using your package manager if you're on Linux. NOTE if you're on Windows, git2r does not support the SSH protocol yet :/

After you've installed LibSSH2 you'll need to reinstall the git2r package to enable SSH transport (since it's enabled/disabled during the package build).

Sources

Issues on GitHub:

Why do I need LibSSH2 at all? git doesn't use it, right?

You're right! git doesn't use it (to my knowledge). However, libgit2, which is the pure C git API implementation that git2r uses, does.

楼主:注意如果你在Windows上,git2r不支持SSH协议:/解释它,谢谢你的回答!

(原文:NOTE if you're on Windows, git2r does not support the SSH protocol yet :/ That explains it, thanks for the answer!)