You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should gh_token_help() report bad credentials (401)? #1413
I know this is covered in git_sitrep(), but I'm wondering if gh_token_help() should report if a discovered token throws a 401 error.
For example, I have a token whose access I just revoked, but gh_token_help() does not report any errors:
usethis::gh_token_help()
#> ● GitHub host: 'https://github.com'#> ● Host online: TRUE#> ● Personal access token for 'https://github.com': '<discovered>'#> ℹ Call `gh::gh_whoami()` to see info about your token, e.g. the associated user#> ℹ To see or update the token, call `gitcreds::gitcreds_set()`#> ✔ If those results are OK, you are good go to!#> ℹ Read more in the 'Managing Git(Hub) Credentials' article:#> https://usethis.r-lib.org/articles/articles/git-credentials.htmlgh::gh_whoami()
#> Error in gh_process_response(raw): #> GitHub API error (401): #> Message: Bad credentials#> Read more at https://docs.github.com/rest
Note to self: Just did some troubleshooting with Tareef, who had an invalid PAT in .Renviron and had set a good PAT via gitcreds. On RStudio Server and the aggravating failure was from remotes::install_github(). I.e. he couldn't install from GitHub because remotes was finding the bad PAT in the env var.
I need to recreate this situation and see what help git_sitrep() and gh_token() offers (or not). And also make sure Happy Git is sending people to these functions for troubleshooting.
Just leaving a note here as a concise list to check in case nothing seems to be working:
The PAT could be saved in multiple places on a Windows computer. The following should be checked:
the .Renviron in the User's HOME. By default that's in "Documents"
Project specific .Renvirons, which would be in the root of project folders
The Windows Credential Manager. Find it by typing "Credential Manager" into the Windows search. Switch to "Windows Credential" and delete anything that says GitHub on it
The Windows Environment Variables. Make sure you check both the user and system locations.
I somehow managed to have random PATs saved in each one of these categories. Deleting everything let me follow normal instructions.
Activity
jennybc commentedon Apr 15, 2021
Note to self: Just did some troubleshooting with Tareef, who had an invalid PAT in
.Renvironand had set a good PAT via gitcreds. On RStudio Server and the aggravating failure was fromremotes::install_github(). I.e. he couldn't install from GitHub because remotes was finding the bad PAT in the env var.I need to recreate this situation and see what help
git_sitrep()andgh_token()offers (or not). And also make sure Happy Git is sending people to these functions for troubleshooting.DataStrategist commentedon Jun 23, 2023
Just leaving a note here as a concise list to check in case nothing seems to be working:
The PAT could be saved in multiple places on a Windows computer. The following should be checked:
.Renvironin the User'sHOME. By default that's in "Documents".Renvirons, which would be in the root of project foldersI somehow managed to have random PATs saved in each one of these categories. Deleting everything let me follow normal instructions.
Refactor PAT sitrep functionality; update docs