Skip to main content

Setting your timeout period for GitHub Codespaces

You can set your default timeout for GitHub Codespaces in your personal settings page.

About the idle timeout

A codespace will stop running after a period of inactivity. By default this period is 30 minutes, but you can specify a longer or shorter default timeout period in your personal settings on GitHub. The updated setting will apply to any new codespaces you create, or to existing codespaces the next time you start them. You can also specify a timeout when you use GitHub CLI to create a codespace.

Warning: Codespaces compute usage is billed for the duration for which a codespace is active. If you're not using a codespace but it remains running, and hasn't yet timed out, you are billed for the total time that the codespace was active, irrespective of whether you were using it. For more information, see "Acerca de la facturación de GitHub Codespaces."

Inactivity defined

En el contexto del tiempo de espera de inactividad de Codespaces, la inactividad se define como la ausencia de actividad indicativa de la presencia de un usuario. La interacción personal con un codespace, como escribir o usar el mouse, restablece el periodo de tiempo de espera de inactividad. La actividad del terminal, ya sea de entrada o salida, también restablece el periodo de tiempo de espera de inactividad. Por ejemplo, si publicas una aplicación web en un puerto desde un codespace y las solicitudes de página generan resultados en un terminal en el codespace, cada vez que ocurra esto se restablecerá el tiempo de expiración. Sin embargo, si compartes un puerto y, a continuación, no interactúas con el codespace y no se genera ningún resultado en el terminal, el codespace agotará el tiempo de espera después del periodo configurado.

Timeout periods for organization-owned repositories

Organizations can set a maximum idle timeout policy for codespaces created from some or all of their repositories. If an organization policy sets a maximum timeout which is less than the default timeout you have set, the organization's timeout will be used instead of your setting. You will be notified of this after the codespace is created. For more information, see "Restricción del período de tiempo de espera de inactividad."

Setting your default timeout period

  1. En la esquina superior derecha de cualquier página, haga clic en la foto del perfil y, luego, en Settings (Configuración).

    Screenshot of a user's account menu on GitHub. The menu item "Settings" is outlined in dark orange.

  2. En la sección "Código, planificación y automatización" de la barra lateral, haz clic en Codespaces.

  3. Under "Default idle timeout", enter the time that you want, then click Save. The time must be between 5 minutes and 240 minutes (4 hours).

    Screenshot of the "Default idle timeout" section of the Codespaces settings, with "90 minutes" entered.

Setting the timeout period for a codespace

Para más información sobre GitHub CLI, consulta "Acerca del CLI de GitHub".

To set the timeout period when you create a codespace, use the idle-timeout argument with the codespace create subcommand. Specify the time in minutes, followed by m. The time must be between 5 minutes and 240 minutes (4 hours).

gh codespace create --idle-timeout 90m

If you don't specify a timeout period when you create a codespace, then the default timeout period will be used. For information about setting a default timeout period, click the "Web browser" tab on this page. You can't currently specify a default timeout period through GitHub CLI.

Setting a timeout period

You can set your default timeout period in your web browser, on GitHub.com. Alternatively, if you use GitHub CLI to create a codespace you can set a timeout period for that particular codespace. For more information, click the appropriate tab above.

Further reading