Skip to content

Do something about GITHUB_PAT=ajskdfjlskflsksdlfkj in .Renviron #1488

Closed

Description

@jennybc

Many people dutifully follow the advice to get a new PAT and put it into the Git credential store with gitcreds.

But then they still get error messages about an invalid PAT!

A very common reason is that they still have an old PAT in .Renviron that is masking the new one, i.e. preventing gitcreds from going into the store.

This is very near the top of our article Managing Git(Hub) Credentials:

If you have previously set your GitHub PAT in .Renviron, stop doing that.

and again later:

If you have previously made your GitHub PAT available by setting the GITHUB_PAT environment variable in .Renviron, you need to actively stop doing that.

and a detailed footnote:

If you have any doubt about your previous practices, open .Renviron, look for any line setting the GITHUB_PAT environment variable, and delete it. usethis::edit_r_environ() can be helpful for getting .Renviron open for editing. Don’t forget to restart R for this change to take effect.

but quite a few users still miss this point.

git_sitrep() should probably help to surface that GITHUB_PAT is being set in .Renviron. Once someone is frustrated and troubleshooting, maybe a hint in git_sitrep() would be enough to allow them to diagnose and solve the problem.

Activity

  1. added
    gitgit, GitHub, and CI in general
    on Sep 17, 2021
  2. added this to the milestone on Sep 28, 2021
  3. AmeliaMN commented on Dec 16, 2021

    @AmeliaMN

    Just ran into this again and the updated version of usethis saved me. Thank you!

  4. added a commit that references this issue on Oct 21, 2024
    1824405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gitgit, GitHub, and CI in general

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions