Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Vendored git-auth.R will need a re-vendor if gitcreds renames the cache env var

Open
#484 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
git, r

Research direction

Start with the vendored copy in R/git-auth.R, especially line 219 and git_creds_for_url(), then check the referenced gitcreds pull requests for the final cache-variable naming. Done means re-vending the file when the upstream change lands and preserving the documented FAIL-sentinel behavior between the copies.

Written by the indexing model from the issue text.

Description

R/git-auth.R is a vendored copy of the gitcreds standalone file. Line 219 computes the cache
environment variable name:

paste0("GITHUB_PAT_", toupper(slug3))

There are open PRs on gitcreds to move that prefix to GITCREDS_PAT_: r-lib/gitcreds#76, r-lib/gitcreds#77 and r-lib/gitcreds#78, for r-lib/gitcreds#56. Filing here so the re-vendor is on the radar.

One specific to pkgdepends: git_creds_for_url() writes "FAIL" to the computed name as a
negative cache, and gitcreds honors that sentinel by throwing before it asks git. So the variable
is a channel between the two copies, not just a user-facing string. r-lib/gitcreds#77 deliberately scopes
the sentinel to the canonical name, because honoring it under legacy names too would let a
FAIL written here suppress a credential that is present:

library(gitcreds)

cfg <- tempfile()
writeLines(c(
  "[credential]",
  "\thelper = \"!f() { test \\\"$1\\\" = get && echo username=demo-user && echo password=real-token; }; f\""
), cfg)

url <- "https://gitlab.example.com"
ev  <- gitcreds_cache_envvar(url)   #> "GITHUB_PAT_GITLAB_EXAMPLE_COM"

withr::with_envvar(c(GIT_CONFIG_GLOBAL = cfg, GIT_CONFIG_NOSYSTEM = "1"), {
  gitcreds_get(url, use_cache = FALSE, set_cache = FALSE)$username
  #> [1] "demo-user"                      # the store has a good credential

  withr::with_envvar(structure(list("FAIL"), names = ev), gitcreds_get(url))
  #> Error: Could not find any credentials
})

Worth noting that pak ships pkgdepends in a pinned private library, so the skew between the two
copies outlives a gitcreds upgrade in the user's own library.

Dominant language
C
Stars
135
Forks
47
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/pkgdepends

All issues in r-lib/pkgdepends

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.