Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com> Co-authored-by: Grace Park <gracepark@github.com> Co-authored-by: Steve Guntrip <12534592+stevecat@users.noreply.github.com> Co-authored-by: Robert Sese <sese@github.com> Co-authored-by: Peter Bengtsson <peterbe@github.com> Co-authored-by: Rachael Sewell <rachmari@github.com>
88 lines
3.8 KiB
Markdown
88 lines
3.8 KiB
Markdown
---
|
|
title: Managing encrypted secrets for your codespaces
|
|
intro: 'You can store sensitive information, like tokens, that you want to access in your codespaces via environment variables.'
|
|
product: '{% data reusables.gated-features.codespaces %}'
|
|
versions:
|
|
fpt: '*'
|
|
ghec: '*'
|
|
redirect_from:
|
|
- /github/developing-online-with-codespaces/managing-encrypted-secrets-for-codespaces
|
|
- /codespaces/working-with-your-codespace/managing-encrypted-secrets-for-codespaces
|
|
type: how_to
|
|
topics:
|
|
- Codespaces
|
|
- Developer
|
|
- Security
|
|
- Secret store
|
|
shortTitle: Encrypted secrets
|
|
---
|
|
|
|
|
|
|
|
|
|
## About encrypted secrets for {% data variables.product.prodname_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
|
|
- [Credentials for a private image registry](/codespaces/codespaces-reference/allowing-your-codespace-to-access-a-private-image-registry)
|
|
|
|
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.
|
|
|
|
{% data reusables.codespaces.secrets-on-start %}
|
|
|
|
### Naming secrets
|
|
|
|
{% data reusables.codespaces.secrets-naming %} For example, a secret created at the repository level must have a unique name in that repository.
|
|
|
|
{% data reusables.codespaces.secret-precedence %}
|
|
|
|
### Limits for secrets
|
|
|
|
You can store up to 100 secrets for {% data variables.product.prodname_codespaces %}.
|
|
|
|
Secrets are limited to 64 KB in size.
|
|
|
|
## Adding a secret
|
|
|
|
{% data reusables.user_settings.access_settings %}
|
|
{% data reusables.user_settings.codespaces-tab %}
|
|
1. To the right of "Codespaces secrets", click **New secret**.
|
|

|
|
1. Under "Name", type a name for your secret.
|
|

|
|
{% data reusables.user_settings.codespaces-secret-value %}
|
|
{% data reusables.user_settings.codespaces-secret-repository-access %}
|
|
1. 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.
|
|
|
|
{% data reusables.user_settings.access_settings %}
|
|
{% data reusables.user_settings.codespaces-tab %}
|
|
1. Under "Codespaces secrets", to the right of the secret you want to edit, click **Update**.
|
|

|
|
1. Under "Value", click **enter a new value**.
|
|

|
|
{% data reusables.user_settings.codespaces-secret-value %}
|
|
{% data reusables.user_settings.codespaces-secret-repository-access %}
|
|
1. Optionally, to remove the secret's access to a repository, deselect the repository.
|
|

|
|
1. Click **Save changes**.
|
|
|
|
## Deleting a secret
|
|
|
|
{% data reusables.user_settings.access_settings %}
|
|
{% data reusables.user_settings.codespaces-tab %}
|
|
1. Under "Codespaces secrets", to the right of the secret you want to delete, click **Delete**.
|
|

|
|
1. Read the warning, then click **OK**.
|
|

|
|
|
|
## Further Reading
|
|
|
|
- "[Managing encrypted secrets for your repository and organization for {% data variables.product.prodname_codespaces %}](/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-codespaces)"
|