Differentiate between an error in the owner/repo vs an error in the token with gh auth login --with-token
#9116
Replies: 2 comments 4 replies
-
Hi @topherbuckley, I don't fully understand your comment relating to With regards the error:
I understand that this might be misleading but if I understand your problem correctly, there's intentionality behind it. If a repository is not public, GitHub won't leak information about it's existence, as that in itself is not public information. There shouldn't be a way to distinguish "the repo doesn't exist" and "my token doesn't have permissions to see the repo". Cheers. |
Beta Was this translation helpful? Give feedback.
-
@williammartin thank you for your speedy and informative replies.
My appologies, I should have included the actual commands for clarity. Here is the sequence of commands used:
Actually with the 2nd command (not gh auth) I get the error:
Sorry, that was misleading on my question.
I see! I had not thought of that.
Yes, I think that would work as I know the required scopes for this use case. Is there a way to check which scopes are permitted by a given token using |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm trying to create an error for users of a project of mine that depends on the user having the $GITHUB_TOKEN env var set. If they do not have this set, the only error I get out from gh auth is:
which is very misleading as the repo exists, I just intentionally removed some permissions from a token, or unset the token as a test for this. I thought I saw somewhere that if you use the API directly there are specific errors for this. Is that the case, and if so, how to replace
gh auth login --with-token
with such an API call? Otherwise, how can I differentiate between an error in the owner/repo vs an error in the token?Beta Was this translation helpful? Give feedback.
All reactions