Granting GitHub Repo Access to Organization Secrets
Learn how to update GitHub secrets settings when adding a new repository. Follow this guide to ensure your new repo has the necessary access.
Learn how to update GitHub secrets settings when adding a new repository. Follow this guide to ensure your new repo has the necessary access.
Secrets in GitHub allow environment variables to be shared and utilized at either the repository or organization level. If you are using organization-level secrets, you may need to update these secrets regularly to change which repositories have access.
In this guide, we’ll show how you can create or update organization-level secrets so they can be granted to the relevant repositories.
When you create a new organization secret in GitHub, you can set a value and specify which repositories have access. You can do this using either the GitHub console or the GitHub CLI.
Here are the steps for creating a new organization-level secret and extending access to certain repositories:
You can also do this same action with the GitHub CLI. You just need to run the following command:
Replace the parameters above with your unique values. Here’s an example where the secret value is contained in the content of a file:
This will generate a new secret with the name provided and assign it to the repository indicated. To check that your changes have been made, you can use the following command to view all secrets associated with the repository:
If your new secret is in the list, then you’ve successfully created a new secret and assigned it to a specific repository. What if you already have the secret in your GitHub organization, and you just want to update it?
What if you already have the secret in your GitHub organization, and you just want to update it to extend access to a new repository? Here’s how you can make those updates.
Here are the steps for updating a secret using the browser:
To add a repository to an existing organization-level secret using the GitHub CLI, run the following command:
Once you’ve run this, you can test that it has worked by running the same command from the section above:
If the relevant secret is now included in the list for your new repository, then you have successfully made the update.
As we’ve just shown, it isn’t difficult to create a new secret in GitHub or update its repositories, but it does take context-switching and manual steps.
With Blink, you can simplify this task by using this pre-built automation from our no-code library.
When you input parameters like which repo needs access to which secret, this automation runs the following steps:
This is a simple automation, which makes it easy to customize. For example, you could drag-and-drop an approval step that asks via Slack whether this is appropriate.
You can also trigger automations so that whenever a new repository is created, you can run checks to ensure that branch protection rules and vulnerability scanning are enabled.
Get started with Blink and streamline and standardize your GitHub workflows today.
Blink is secure, decentralized, and cloud-native. Get modern cloud and security operations today.