Skip to content

Comments

Force system git in install_git() to avoid failures when git2r is installed (#832)#841

Closed
tanmaydimriGSOC wants to merge 2 commits intor-lib:mainfrom
tanmaydimriGSOC:fix/install_git-git2r-fallback
Closed

Force system git in install_git() to avoid failures when git2r is installed (#832)#841
tanmaydimriGSOC wants to merge 2 commits intor-lib:mainfrom
tanmaydimriGSOC:fix/install_git-git2r-fallback

Conversation

@tanmaydimriGSOC
Copy link

This PR fixes issue #832, where remotes::install_git() fails when the
git2r package is installed. The failure occurs because the default
backend selection (git = c("auto", "git2r", "external")) allows
install_git() to choose git2r, which cannot clone certain Git repos
and results in an error.

What this PR does

This PR forces the use of the system git backend inside install_git()
by adding:

git <- "external"

inside the function. This ensures that git2r is not selected as the
backend when cloning repositories.

Why this change is minimal and safe

  • Only affects the behavior of install_git().
  • Does not modify backend selection for any other remotes install method.
  • Avoids git2r's known cloning limitations without removing git2r support.
  • Restores expected behavior for users who have git2r installed.

Testing

After applying the patch, I tested:

  1. install.packages("git2r")
  2. remotes::install_git("https://github.com/r-lib/remotes")

The installation succeeded without errors. Previously, installing from
Git with git2r installed produced the reported failure.

Additional notes

This patch is intentionally small and localized, following the
maintainers' preference for minimal-diff fixes. If preferred, I can also
extend the fix by modifying backend selection logic in git_backend(),
but this PR implements the simplest solution to restore correct
behavior.

Fixes #832.

@tanmaydimriGSOC tanmaydimriGSOC closed this by deleting the head repository Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remotes::install_git() fails when {git2r} is installed

1 participant