r sourcing private repos from github

2019-04-10 05:46发布

Hi I was wondering how to source private repos in github that I have been given access to.

Using the devtools package, it is easy enough to source open repos by using commands such as:

source_url('https://raw.github.com/hadley/stringr/master/R/c.r')

but doing the equivalent with the URL for a private repo doesn't seem to work.

P.S. I know I can clone the whole repo, and then get the file that way, but I'm looking for just one specific file in the whole repo to take, and it's a bit inefficient to clone the whole thing, copy the code and the use it as necessary.

1条回答
Fickle 薄情
2楼-- · 2019-04-10 06:09

I'm not really familiar with R, but I usually include private repositories in my projects using the Git protocol over SSH.

GitHub requires you to authenticate in order to download private code. If you use Git over SSH, your machine will authenticate with your SSH key when you pull in your project dependencies. I do this with Ruby projects that make use of private gems, but I'm not sure if R lets you fetch dependencies using Git over SSH.

查看更多
登录 后发表回答