r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
332 stars 152 forks source link

Install with private deps fails using usethis git credentials #792

Open latot opened 6 months ago

latot commented 6 months ago

Hi, this might be similar to https://github.com/r-lib/remotes/issues/758, also the pak library works for this case, but is ideal to work here too.

Rn using usethis we can use git credentials: https://stackoverflow.com/a/71846333/4652030

Still not the ideal case thinking we could use the actual git credentials instead register two in the same system, but still following that we have two credentials on the system to download private repos.

After following the steps, we can install the private repo, the problem is that when the project has a private dependency, if this is the case we will not be able to install the package with:

Downloading git repo https://github.com/CIT-UAI/rtestB
'/usr/bin/git' clone --depth 1 --no-hardlinks https://github.com/CIT-UAI/rtestB /tmp/RtmpuXMEtf/file386464b17622a
Clonando en '/tmp/RtmpuXMEtf/file386464b17622a'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 6 (delta 0), pack-reused 0
Recibiendo objetos: 100% (7/7), listo.
Error: Failed to install 'unknown package' from Git:
  HTTP error 404.
  Not Found

  Did you spell the repo owner (`CIT-UAI`) and repo name (`rtestC`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

So seems the usethis git credentials are picked for the main project, but not parsed to the deps.

Thx!

gaborcsardi commented 6 months ago

It is very possible that remotes sends the same credentials for all repositories, which is certainly not great. In any case, we are focusing on pak, so if you can use pak, that's a great workaround.

latot commented 6 months ago

will pak replace remotes? I'm thinking that devtools uses remotes instead of pak.

gaborcsardi commented 6 months ago

Yes, devtools will use pak in the near future.