r-lib / pak

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

Error installing private git repo with ssh url #569

Closed m-muecke closed 9 months ago

m-muecke commented 9 months ago

I'm getting the following error when trying to install a private git repo with a ssh URL (substituted r-lib/pak as the url for the example, but getting the same error with a private repo hosted on Gitea). The error doesn't occur when I run remotes::install_git instead.

pak::pak("git::git@github.com:r-lib/pak.git")
#> Error: ! error in pak subprocess
#> Caused by error: 
#> ! Could not solve package dependencies:
#> * git::git@github.com:r-lib/pak.git: ! pkgdepends resolution error for git::git@github.com:r-lib/pak.git.
#> Caused by error: 
#> ! Failed to download 'DESCRIPTION' from git repo at
#> <://git@github.com:r-lib/pak.git>.
#> Caused by error in `(function (e) …`:
#> ! URL rejected: Port number was not a decimal number between 0 and 65535

Created on 2023-12-08 with reprex v2.0.2

gaborcsardi commented 9 months ago

ssh urls are currently not supported, only https, sorry.

m-muecke commented 9 months ago

That explains a lot. But I'm getting the same error for the private repo hosted on Gitea using https, whereas I'm not getting an error with remotes.

gaborcsardi commented 9 months ago

I am fairly sure that you are not getting the same

#> ! URL rejected: Port number was not a decimal number between 0 and 65535

error for a https git repo.

But in any case, you'll have to show us the code you are running and the output you are getting. Ideally, you could show a reproducible example, but that might be hard in this case.

m-muecke commented 9 months ago

Here the error output, just exchanged the real name for blank:

pak::pak("git::https://gitea.blank.de/repl/replraw.git")
#> Error: ! error in pak subprocess
#> Caused by error: 
#> ! Could not solve package dependencies:
#> * git::https://gitea.blank.de/repl/replraw.git: ! pkgdepends resolution error for
#> git::https://gitea.blank.de/repl/replraw.git.
#> Caused by error: 
#> ! Failed to download 'DESCRIPTION' from git repo at
#> <https://gitea.blank.de/repl/replraw.git>.
#> Caused by error in `(function (e) …`:
#> ! URL rejected: Port number was not a decimal number between 0 and 65535

Created on 2023-12-08 with reprex v2.0.2

gaborcsardi commented 9 months ago

IS it possible that your git config still uses the ssh url, and that is used when pak is trying to get the credentials from the git credential store?

E.g. does

gitcreds::gitcreds_get(url = "https://...")

work?

m-muecke commented 9 months ago

Getting the following:

gitcreds::gitcreds_get(url = "https://...")
#> <gitcreds>
#>   protocol: https
#>   host    : gitea...
#>   username: maximilian...
#>   password: <-- hidden -->

Created on 2023-12-08 with reprex v2.0.2

gaborcsardi commented 9 months ago

OK, I can reproduce this, and it is probably a bug in pak, unfortunately.