usethis::use_github() error in validate_gh_pat

Hi! I tried to connect my local repo with github, but it returns an error message:

usethis::use_github()
#> √ Checking that current branch is default branch ('master')
#> Error in validate_gh_pat(new_gh_pat(x)) : 
#>   A GitHub PAT must consist of 40 hexadecimal digits

Just prior to that, I created token with usethis::create_github_token() and set PAT using gitcreds::gitcreds_set(). When I run gitcreds::gitcreds_set() one more time and select 3: See the password / token, it returns the correct token but it consists of not hexadecimal digits.

What did I wrong?

Try updating the gh package. It recently added support for the new GitHub token format, which you’re probably seeing. The new tokens start with ghp_ I believe, and gh used to have trouble with that.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.