Note: Encrypted secrets for Codespaces is currently in beta and subject to change.
About encrypted secrets for Codespaces
You can add encrypted secrets to your user account that you want to use in your codespaces. For example, you may want to store and access the following sensitive information as encrypted secrets.
- Personal access tokens to cloud services
- Service principals
- Subscription identifiers
You can choose which repositories should have access to each secret. Then, you can use the secret in any codespace you create for a repository that has access to the secret.
Adding a secret
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the left sidebar, click Codespaces.
- To the right of "Codespaces secrets", click New secret.
- Under "Name", type a name for your secret.
- Under "Value", type the value of your secret.
- Select the "Repository access" drop-down menu, then click a repository you want to have access to the secret. Repeat for every repository you want to have access to the secret.
- Click Add secret.
Editing a secret
You can update the value of an existing secret, and you can change which repositories can access a secret.
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the left sidebar, click Codespaces.
- Under "Codespaces secrets", to the right of the secret you want to edit, click Update.
- Under "Value", click enter a new value.
- Under "Value", type the value of your secret.
- Select the "Repository access" drop-down menu, then click a repository you want to have access to the secret. Repeat for every repository you want to have access to the secret.
- Optionally, to remove the secret's access to a repository, deselect the repository.
- Click Save changes.
Deleting a secret
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the left sidebar, click Codespaces.
- Under "Codespaces secrets", to the right of the secret you want to delete, click Delete.
- Read the warning, then click OK.