问题
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/")
but, I keep getting
Error in 'git2r_clone': unsupported URL protocol
What could be wrong?
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.
I made sure to install libssh2
per this answer
回答1:
This can happen if your git2r installation does not support SSH and therefore can't parse git SSH URLs.
You can confirm by running
libgit2_features()
in R.
If SSH is disabled, you will see
$threads
[1] TRUE
$https
[1] TRUE
$ssh
[1] FALSE
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 libssh2
and brew install libgit2
.
After that, re-install git2r from source with
install.packages("git2r", type="source", configure.vars="autobrew=yes")
Reload git2r with library(git2r)
. Now if you run libgit2_features()
in R, you should see ssh TRUE
来源:https://stackoverflow.com/questions/60176959/getting-unsupported-url-protocol-when-using-ssh-authentication-with-git2rclo