Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remotes 2.4.0 breaks installation of private company GitLab repo #632

Open
jr-leary7 opened this issue Jul 9, 2021 · 2 comments
Open

remotes 2.4.0 breaks installation of private company GitLab repo #632

jr-leary7 opened this issue Jul 9, 2021 · 2 comments
Labels

Comments

@jr-leary7
Copy link

With remotes 2.2.0, the following lines worked to install a company R package I maintain from GitLab to local:

remotes::install_git(url = "https://gitlab.company.com/user/package.git", 
                                  credentials = git2r::(username = "user", password = "password"))

However, as of remotes 2.4.0 that code results in the following error:

Error: Failed to install 'unknown package' from Git:
    Line starting '<DOCTYPE html> ...' is malformed!

From the reading I've done my limited understanding is that somehow the request is getting sent to a GitLab login page, and thus the file it's retrieving is the HTML of that page. I confirmed this morning that the install worked for a user with devtools v2.3.2 and remotes v2.2.0, but it does not work for me on devtools v2.4.1 and remotes v2.4.0.

@rnorberg
Copy link
Contributor

rnorberg commented Jul 9, 2021

This change introduced the issue. The problem is that remote_package_name.git2r_remote is trying to download the package DESCRIPTION file (to determine the package name), but the call to download in remote_package_name.git2r_remote doesn't get passed the credentials supplied by the user to install_git.

The result is that instead of downloading the package's DESCRIPTION file, you download GitLab's login page if the package repo isn't public.

rnorberg added a commit to rnorberg/remotes that referenced this issue Jul 9, 2021
Related to r-lib#632 and r-lib#625. Now, when trying to download a package's `DESCRIPTION` file from a repo that requires authentication, some types of credentials (`git2r::cred_user_pass`, `git2r::cred_env`, and `git2r::cred_token`) are passed to the (internal) `download` function.
@rnorberg
Copy link
Contributor

rnorberg commented Jul 9, 2021

#628 resolves this by amending remote_package_name.git2r_remote to return NA_character_ instead of throwing an error.

I proposed #633 to actually pass credentials supplied to install_git's credentials argument on to the (internal) download function.

Whether #633 is accepted or not, I think this issue can be marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants