Managing encrypted secrets for your codespaces

You can store sensitive information, like tokens, that you want to access in your codespaces via environment variables.

Codespaces is available for organizations using GitHub Team or GitHub Enterprise Cloud. 詳しい情報については「GitHubの製品」を参照してください。

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.

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.

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 Command Palette in Codespaces."

Naming secrets

The following rules apply to secret names:

  • Secret names can only contain alphanumeric characters ([a-z], [A-Z], [0-9]) or underscores (_). Spaces are not allowed.

  • Secret names must not start with the GITHUB_ prefix.

  • Secret names must not start with a number.

  • Secret names are not case-sensitive.

  • Secret names must be unique at the level they are created at. For example, a secret created at the repository level must have a unique name in that repository.

    If a secret with the same name exists at multiple levels, the secret at the lower level takes precedence. For example, if an organization-level secret has the same name as a repository-level secret, then the repository-level secret takes precedence.

Limits for secrets

You can store up to 100 secrets for Codespaces.

Secrets are limited to 64 KB in size.

Adding a secret

  1. 任意のページの右上で、プロフィール画像をクリックし、続いてSettings(設定)をクリックしてください。 ユーザバーの [Settings(設定)] アイコン
  2. In the left sidebar, click Codespaces. Codespaces tab in the user settings sidebar
  3. To the right of "Codespaces secrets", click New secret. "New secret" button
  4. Under "Name", type a name for your secret. "Name" text box
  5. Under "Value", type the value of your secret. "Value" textbox
  6. 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. "Repository access" drop-down menu
  7. 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.

  1. 任意のページの右上で、プロフィール画像をクリックし、続いてSettings(設定)をクリックしてください。 ユーザバーの [Settings(設定)] アイコン
  2. In the left sidebar, click Codespaces. Codespaces tab in the user settings sidebar
  3. Under "Codespaces secrets", to the right of the secret you want to edit, click Update. "Update" button
  4. Under "Value", click enter a new value. "enter a new value" link
  5. Under "Value", type the value of your secret. "Value" textbox
  6. 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. "Repository access" drop-down menu
  7. Optionally, to remove the secret's access to a repository, deselect the repository. Checkboxes to remove access to repositories
  8. Click Save changes.

Deleting a secret

  1. 任意のページの右上で、プロフィール画像をクリックし、続いてSettings(設定)をクリックしてください。 ユーザバーの [Settings(設定)] アイコン
  2. In the left sidebar, click Codespaces. Codespaces tab in the user settings sidebar
  3. Under "Codespaces secrets", to the right of the secret you want to delete, click Delete. "Delete" button
  4. Read the warning, then click OK. Confirmation to delete secret

このドキュメントは役立ちましたか?プライバシーポリシー

これらのドキュメントを素晴らしいものにするのを手伝ってください!

GitHubのすべてのドキュメントはオープンソースです。間違っていたり、はっきりしないところがありましたか?Pull Requestをお送りください。

コントリビューションを行う

OR, コントリビューションの方法を学んでください。

問題がまだ解決していませんか?

GitHubコミュニティで質問するサポートへの連絡