Skip to main content

Managing encrypted secrets for your repository and organization for GitHub Codespaces

Encrypted secrets allow you to store sensitive information in your organization, repository, or GitHub Codespaces.

Who can use this feature

To manage secrets for GitHub Codespaces for an organization, you must be an organization owner.

About secrets

Secrets are encrypted environment variables that you create in an organization or repository. The secrets that you create are available to use in GitHub Codespaces. GitHub uses a libsodium sealed box to encrypt secrets before they reach GitHub and only decrypts them when you use them in a codespace.

Organization-level secrets let you share secrets between multiple repositories, which reduces the need to create duplicate secrets. You can use access policies to control which repositories can use organization secrets.

Once you have created a secret, it will be available when you create a new codespace or restart the codespace. To use a secret that you've just created in a current codespace, you will need to stop the codespace and resume it. For information about stopping the codespace, see "Using the Visual Studio Code Command Palette in GitHub Codespaces."

Naming secrets

Las siguientes reglas aplican a los nombres secretos:

  • Los nombres de secretos solo pueden contener caracteres alfanuméricos ([a-z], [A-Z], [0-9]) o caracteres de subrayado (_). No se permiten espacios.

  • Los nombres de secreto no deben comenzar con el prefijo GITHUB_.

  • Los nombres secretos no deben comenzar con un número.

  • Los nombres de secreto no distinguen entre mayúsculas y minúsculas.

  • Los nombres secretos deben ser únicos en el nivel en el que se hayan creado. For example, a secret created at the repository level must have a unique name in that repository, and a secret created at the organization level must have a unique name at that level.

    Si existe un secreto con el mismo nombre en varios niveles, tiene preferencia el del nivel más bajo. Por ejemplo, si un secreto a nivel de organización tiene el mismo nombre que un secreto a nivel de repositorio, entonces el secreto a nivel de repositorio tomará precedencia.

Limits for secrets

You can store up to 100 secrets per organization and 100 secrets per repository.

Secrets are limited to 64 KB in size.

Adding secrets for a repository

To create secrets for an organization repository, you must have administrator access.

  1. On GitHub.com, navigate to the main page of the repository.

  2. Debajo del nombre del repositorio, haz clic en Configuración. Botón de configuración del repositorio

  3. En la sección "Seguridad" de la barra lateral, selecciona Secretos y haz clic en Codespaces .

  4. At the top of the page, click New repository secret.

  5. Type a name for your secret in the Name input box.

  6. Enter the value for your secret.

  7. Click Add secret.

Adding secrets for an organization

When creating a secret in an organization, you can use a policy to limit which repositories can access that secret. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.

Para crear secretos en el nivel de la organización, debe tener acceso admin.

  1. On GitHub.com, navigate to the main page of the organization.

  2. Debajo del nombre de la organización, haga clic en Settings. Botón de configuración de la organización

  3. En la sección "Seguridad" de la barra lateral, selecciona Secretos y haz clic en Codespaces .

  4. At the top of the page, click New organization secret.

  5. Type a name for your secret in the Name input box.

  6. Enter the Value for your secret.

  7. From the Repository access dropdown list, choose an access policy. Repository Access list with private repositories selected

  8. Click Add secret.

Reviewing access to organization-level secrets

You can check which access policies are applied to a secret in your organization.

  1. On GitHub.com, navigate to the main page of the organization.

  2. Debajo del nombre de la organización, haga clic en Settings. Botón de configuración de la organización

  3. En la sección "Seguridad" de la barra lateral, selecciona Secretos y haz clic en Codespaces .

  4. The list of secrets includes any configured permissions and policies. For example: Secrets list

  5. For more details on the configured permissions for each secret, click Update.

Further reading