No option "Only select repositories" when creating a fine grained acces token. #73027
-
Select Topic AreaQuestion BodyI am trying to create an access token for a private repo. With the access token, I only want to grant access to this repo, and no others. Online I see that the fine grained access token has an option "Only select repositories", however when I am creating a token this option does not show up (see the screenshot). edit: In several posts I see users with fine grained access tokens that do get the option for "only select repositories". For example in the GIF on this link:https://github.blog/2022-10-18-introducing-fine-grained-personal-access-tokens-for-github/. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
The option to grant access to select repositories when creating a personal access token is not available. Personal access tokens in GitHub provide access to all repositories the user has access to, based on the selected scopes. But you can use GitHub Apps, it allows more fine-grained permissions compared to personal access tokens, you can specify which repositories the app can access. After creating the app, you can install it on your account and give it access to specific repositories. The app will then have its own unique access token which can be used to authenticate on behalf of the app. Be careful when handling access tokens as they provide access to your repositories; never share them publicly or commit them into your code. 🍀 |
Beta Was this translation helpful? Give feedback.
-
All right, here we go... OAuth GitHub App GitHub account => Settings => Applications => Authorized OAuth Apps => Click on the application you want to manage => Organization access => Click on "Grant" or "Request" next to the organization you want to give access to. If you're an owner, you'll see "Grant", otherwise you'll see "Request". GitHub App Hope this is sufficient for you, if so, I would appreciate closing the discussion. 😄 Cheers. 🍺 P.S. Try reading the documentation, you might find the valuable insights. 🍀 |
Beta Was this translation helpful? Give feedback.
-
I find the selected answer unsatisfying. This appears to happen when the user has no repositories available. By default, can only generate fine grained access tokens for repositories your user owns, so if your user owns no repositories you won't see the option to select repositories. You're likely trying to generate a token for a repository owned by an organization, so you need make sure the organization the repo belongs to has enabled "Allow access via fine-grained personal access tokens" in the organizations settings. Docs here. After this you'll be able to see the option. |
Beta Was this translation helpful? Give feedback.
-
After finding the selected answer incomplete, I have discovered how to make the option appear even after you have enabled "Allow access via fine-grained personal access tokens" in the organization settings. When creating a fine-grained personal access token, the fourth setting field is a drop-down entitled "Resource owner". By default, this will show your user profile name. It is non-intuitive to think you need to change anything here because you are, after all, generating a Personal Access Token. However, if you click on the "Resource owner" drop down list, you will then be able to select your Organization. Then, you will be presented with the option "Only select repositories" under Repository access. Hopefully, this answer helps others. |
Beta Was this translation helpful? Give feedback.
I find the selected answer unsatisfying.
This appears to happen when the user has no repositories available. By default, can only generate fine grained access tokens for repositories your user owns, so if your user owns no repositories you won't see the option to select repositories. You're likely trying to generate a token for a repository owned by an organization, so you need make sure the organization the repo belongs to has enabled "Allow access via fine-grained personal access tokens" in the organizations settings. Docs here.
After this you'll be able to see the option.