r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
639 stars 56 forks source link

[Feature Request] Support SSH for Github #611

Open latot opened 2 months ago

latot commented 2 months ago

Would be great be able to install packages when git uses ssh keys to download and access them.

As described here only works https ones (https://github.com/r-lib/pak/issues/569#issuecomment-1847545496)

Thx!

gaborcsardi commented 2 months ago

Unfortunately that's very hard to implement if we don't want to depend on git.

It is usually easy to use https, either via the git credential store or via the GITHUB_PAT env var.

Can you please explain why you need ssh?

latot commented 2 months ago

Some reasons.

Thx

gaborcsardi commented 2 months ago

First of all, downloading through https already works for everybody for public repos, even if you don't set any credentials.

For private repos, or if you want to avoid rate limits, all you need is to request a personal access token and set it in an environment variable.

IMO these are simpler than installing ssh or libssh or even git, especially on Windows and macOS.

We might have ssh support at some point, but considering that it is a lot of work, it probably won't happen soon.

latot commented 2 months ago

I thought it was simple, but seems is not that simple to register tokens in windows, works the first time, then they are deleted after some time (less than one day), using the credentials library.

gaborcsardi commented 2 months ago

The default expiration time is 30 days for classic tokens. But you can also choose to keep them forever.

No need to use the credentials package if that's what you mean, use gitcreds::gitcreds_set() or set the GITHUB_PAT env var in you .Renviron.