For certain tasks, such as creating Restricted Contexts or adjusting your plan settings, we require that the user have "Admin" permissions for the organization being modified.
We check if you are an admin based on if you have "Owner" status for the GitHub organization. If you do, your user will be able to perform any administrative functions on CircleCI.
If you are trying to create a namespace and the token is simply outdated or wrong you get this error:
Error: Unable to find organization <org> of vcs-type GITHUB: Either the org 'github/<org>' does not exist or you do not have permission to view it.: the organization '<org>' under 'GITHUB' VCS-type does not exist. Did you misspell the organization or VCS?
vs a token that is not an admin's scope:
If you are not an owner of the GitHub organization, there is a way to allow non-owners to take this action via a context associated with the org owner's personal API token.
This context can be restricted to a certain security group if need be.
Your org owner will need to follow these steps:
- Generate a personal API token: https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token
- Store the token in a context to be used as an environment variable: https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-context
- The environment variable in the context will need to be called CIRCLE_TOKEN
- For namespace creation non owners can ssh into the build and run the one time command using the token
- For orb development, using the Orb Development Kit, assign the publishing-context as the newly-created context: https://github.com/CircleCI-Public/Orb-Project-Template/blob/master/.circleci/config.yml#L54