Skip to content

Change GITHUB_PAT_ prefix to more generic GIT_PAT_ - #72

Closed
melissavanbussel wants to merge 1 commit into
r-lib:mainfrom
melissavanbussel:generic-pat-prefix
Closed

melissavanbussel wants to merge 1 commit into
r-lib:mainfrom
melissavanbussel:generic-pat-prefix

Conversation

@melissavanbussel

Copy link
Copy Markdown
Contributor

Change GITHUB_PAT_ prefix to more generic GIT_PAT_ to remove confusion for non-GitHub users

Fixes #56

SokolovAnatoliy added a commit to SokolovAnatoliy/gitcreds that referenced this pull request Sep 17, 2026
GITHUB_PAT_GITLAB_COM, for a GitLab host, is misleading enough to be a
support burden. r-lib#72 proposed this rename first and is the origin of the
change; this commit differs only in the prefix it picks and in resting
on the compatibility layer added in the previous commit.

GIT_PAT_ was the prefix suggested in r-lib#56, but GIT_* is git's own
namespace (GIT_DIR, GIT_ASKPASS, GIT_TERMINAL_PROMPT). Nothing collides
today, and GITCREDS_PAT_ belongs to the package that owns it.

The old names are still read. A warning fires once per session when one
of them supplied the credential, never when the new name is set, and not
at all for the bare GITHUB_PAT and GITHUB_TOKEN names, which this change
does not affect. Once per session rather than per call because
gitcreds_get() runs deep inside install paths in gh, pkgdepends and
usethis. GITCREDS_LEGACY_WARN=false silences it.

Warn-once is a flag in the local() environment and base warning(),
because test-standalone.R requires every function here to be base only.

The FAIL sentinel now belongs to GITCREDS_PAT_*, so a sentinel written
under the old name by an older vendored copy of this file no longer
suppresses a lookup. The existing cache tests are updated accordingly;
they documented the previous contract.

Co-authored-by: melissavanbussel <[email protected]>

Closes r-lib#56
@gaborcsardi

Copy link
Copy Markdown
Member

Thanks! This is a breaking change, and ideally we'd need to keep gitcreds compatible with existing workflows. So I am going to close this in favor of #77.

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.

Generic PAT prefix when using non-github urls

2 participants