-
Couldn't load subscription status.
- Fork 301
Description
Hi,
Trying to setup pkgdown for package hosted on GitHub (GHE) to no avail. PAT is set and recognized by usethis.
However following error is thrown
usethis::use_pkgdown_github_pages()
Error in `github_remotes()`:
✖ Unable to get GitHub info for these remotes: "origin".
ℹ Are we offline? Is GitHub down? Has the repo been deleted?
ℹ Otherwise, you probably need to configure a personal access token (PAT) for "xxx.ghe.com".
ℹ See usethis::gh_token_help() for advice.Digging through the code it took me through usethis:::target_repo --> usethis:::github_remote_config --> usethis:::github_remotes.
I can see gh::gh being called from within usethis:::github_remotes with owner, repo and .api_url supplied. However, .token is not being supplied and calling
grl <- usethis:::github_remotes(github_get = TRUE)
gh::gh(endpoint = "GET /repos/{owner}/{repo}", owner = grl$repo_owner, repo = grl$repo_name, .api_url = grl$api_url)
GitHub API error (401): Must authenticate to access this API.When I call this function as follows
grl <- usethis:::github_remotes(github_get = TRUE)
creds <- gitcreds::gitcreds_get(url = "xxx.ghe.com")
gh::gh(endpoint = "GET /repos/{owner}/{repo}", owner = grl$repo_owner, repo = grl$repo_name, .api_url = grl$api_url, .token = creds$password)I get response. Using standard github.com (personal account) works fine even without supplying .token to the above call. Supplying wrong token results in 401 while supplying correct token returns.
Am I missing something here?
Thanks a lot for help. :)