Devtools :: install_git Over SSH

I wrote an R package that I store in a (bare) git repository on an SSH server, and I want to be able to install it on a local computer without having to clone the repository manually.

I tried to do the following:

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

but i get an 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 am on a machine under Windows 7 using R 3.1.2, git2r version 0.11.0 and devtools version 1.9.1. Any help would be greatly appreciated. Thanks!

+6
source share
1 answer

Go to this question. I know this question is a bit outdated, but for someone else facing the same problem (like me), this is what I found.

Problem

You probably don't have a library that git2r (the package that devtools uses to interact with git ) uses to communicate via SSH.

Decision

Install it. The example below assumes Ubuntu.

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

git2r uses a library called LibSSH2 to allow SSH transfers. You can install it using the package manager if you are running Linux. NOTE, if you are on Windows, git2r does not yet support SSH: / Like git2r version 0.11.0 (which uses the updated version of libgit2 ), it looks like SSH is also supported on Windows . Starting with this change, the newest version of git2r is 0.15, so if you don’t have SSH support on Windows, try updating git2r (yelling at zeehio for news).

After you installed LibSSH2 , you will need to reinstall the git2r package to enable SSH transport (since it is enabled / disabled during package build).

Sources

Problems with github:

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

You're right! git does not use it (as far as I know). However, libgit2 , which is a pure implementation of the C git API used by git2r .

+9
source

All Articles