Get a personal access token for the GitHub API from
https://github.com/settings/tokens and select the scopes necessary for your
planned tasks. The repo
scope, for example, is one many are likely to need.
On macOS and Windows it is best to store the token in the git credential
store, where most GitHub clients, including gh, can access it. You can
use the gitcreds package to add your token to the credential store:
gitcreds::gitcreds_set()
See https://gh.r-lib.org/articles/managing-personal-access-tokens.html
and https://usethis.r-lib.org/articles/articles/git-credentials.html
for more about managing GitHub (and generic git) credentials.
On other systems, including Linux, the git credential store is
typically not as convenient, and you might want to store your token in
the GITHUB_PAT
environment variable, which you can set in your
.Renviron
file.