By default, GitHub Codespaces are automatically deleted after they have been stopped and have remained inactive for 30 days.
However, because GitHub Codespaces incurs storage charges, you may prefer to reduce the retention period by changing your default period in your personal settings for GitHub Codespaces. For more information about storage charges, see "
About billing for GitHub Codespaces
."
Note
: Whether or not you have set a personal codespace retention period, it's a good idea to get into the habit of deleting codespaces that you no longer need. For more information, see "
Deleting a codespace
."
Automatic deletion happens irrespective of whether a codespace contains unpushed changes. To prevent automatic deletion of a codespace, just open the codespace again. The retention period is reset every time you connect to a codespace, and the retention countdown restarts when the codespace is stopped.
If a repository belongs to an organization, the organization owner may have set a retention period for the whole organization. If this period is less than the default retention period in your personal settings then the organization retention period will apply to codespaces you create for this repository. For more information, see "
Restricting the retention period for codespaces
."
Each codespace has its own retention period. You may, therefore, have codespaces with different retention periods. For example, if:
- You created a codespace, changed your default retention period, then created another codespace.
- You created a codespace using GitHub CLI and specified a different retention period.
- You created a codespace for an organization-owned repository that has a retention period configured in the organization settings. The ownership of the codespaces you create is shown on the "
Your codespaces
" page.
Note
: The retention period is specified in days. A day represents a 24-hour period, beginning at the time of day when you stop a codespace.