Note
This article explains the stages in the life of a codespace, from creation to deletion. If you have read the Quickstart for GitHub Codespaces article and you now want to start using GitHub Codespaces for your own work, see the articles under codespace에서 개발.
About the lifecycle of a codespace
The lifecycle of a codespace begins when you create a codespace and ends when you delete it. You can disconnect and reconnect to an active codespace without affecting its running processes. You may stop and restart a codespace without losing changes that you have made to your project.
Creating a codespace
When you want to work on a project, you can choose to create a new codespace or open an existing codespace. You might want to create a new codespace from a branch of your repository each time you develop in GitHub Codespaces or keep a long-running codespace for a feature. 새 프로젝트를 시작하는 경우 템플릿에서 codespace를 만들고 나중에 GitHub의 리포지토리에 게시할 수 있습니다. For more information, see 리포지토리에 대한 codespace 만들기 and 템플릿에서 codespace 만들기.
만들 수 있는 코드스페이스의 수와 동시에 실행할 수 있는 코드스페이스의 수에는 제한이 있습니다. 이러한 제한은 몇 가지 요인에 따라 달라집니다. codespace 최대 수에 도달하고 다른 codespace를 만들려고 하면 기존 codespace를 제거해야 새 codespace를 만들 수 있다는 메시지가 표시됩니다. Similarly, if you reach the maximum number of active codespaces and you try to start another, you are prompted to stop one of your active codespaces.
If you choose to create a new codespace each time you work on a project, you should regularly push your changes so that any new commits are on GitHub. If you choose to use a long-running codespace for your project, you should pull from your repository's default branch each time you start working in your codespace so that your environment has the latest commits. This workflow is very similar to if you were working with a project on your local machine.
리포지토리 관리자는 codespace 만들기 속도를 높이기 위해 리포지토리에서 GitHub Codespaces 사전 빌드를 사용하도록 설정할 수 있습니다. 자세한 내용은 GitHub Codespaces 사전 빌드 관련 정보을(를) 참조하세요.
Saving changes in a codespace
When you connect to a codespace through the web, auto-save is enabled automatically for the web editor and configured to save changes after a delay. When you connect to a codespace through Visual Studio Code running on your desktop, you must enable auto-save. For more information, see Save/Auto Save in the Visual Studio Code documentation.
Your work will be saved on a virtual machine in the cloud. You can close and stop a codespace and return to the saved work later. If you have unsaved changes, your editor will prompt you to save them before exiting. However, if your codespace is deleted, then your work will be deleted too. To persist your work, you will need to commit your changes and push them to your remote repository, or publish your work to a new remote repository if you created your codespace from a template. For more information, see codespace에서 원본 제어 사용.
Timeouts for GitHub Codespaces
If you leave your codespace running without interaction, or if you exit your codespace without explicitly stopping it, the codespace will timeout after a period of inactivity and stop running. By default, a codespace will timeout after 30 minutes of inactivity, but you can customize the duration of the timeout period for new codespaces that you create. For more information about setting the default timeout period for your codespaces, see Github Codespaces의 시간 제한 기간 설정. For more information about stopping a codespace, see Stopping a codespace.
When a codespace times out, your data is preserved from the last time your changes were saved. For more information, see Saving changes in a codespace.
Rebuilding a codespace
You can rebuild your codespace to implement changes you've made to your dev container configuration. For most uses, you can create a new codespace as an alternative to rebuilding a codespace. By default, when you rebuild your codespace, GitHub Codespaces will reuse images from your cache to speed up the rebuild process. Alternatively, you can perform a full rebuild, which clears your cache and rebuilds the container with fresh images.
Note
codespace에서 컨테이너를 다시 빌드하면 /workspaces
디렉터리 외부에서 수행한 변경 내용이 삭제됩니다. codespace을 생성한 리포지토리 또는 템플릿의 복제본을 포함하는 /workspaces
디렉터리 내에서 변경한 내용은 다시 빌드해도 유지됩니다. 자세한 내용은 Deep dive into GitHub Codespaces을(를) 참조하세요.
For more information, see 개발 컨테이너 소개 and Codespace에서 컨테이너 다시 빌드.
Stopping a codespace
Codespace를 언제든 중지할 수 있습니다. Codespace를 중지하면 실행 중인 모든 프로세스가 중지됩니다. Codespace에서 저장된 변경 내용은 다음에 시작할 때 계속 사용할 수 있습니다. 터미널 기록은 유지되지만, 터미널 창의 표시 콘텐츠는 codespace 세션 간에 유지되지 않습니다.
Codespace를 명시적으로 중지하지 않으면 비활성에서 시간이 초과될 때까지 계속 실행됩니다. codespace를 닫아도 codespace가 중지되지 않습니다. 예를 들어 VS Code 웹 클라이언트에서 codespace를 사용하고 브라우저 탭을 닫으면 codespace가 원격 컴퓨터에서 계속 실행됩니다. 시간 제한에 대한 자세한 내용은 Understanding the codespace lifecycle을(를) 참조하세요.
실행 중인 codespace에서만 CPU 요금이 발생합니다. 중지된 codespace에서는 스토리지 비용만 발생합니다.
Codespace를 중지하고 다시 시작하여 변경 내용을 적용할 수 있습니다. 예를 들어 Codespace에 사용되는 컴퓨터 유형을 변경하는 경우 변경 내용이 적용되려면 이를 중지하고 다시 시작해야 합니다. 또한 Codespace를 중지하고 오류 또는 예기치 않은 오류가 발생하는 경우 다시 시작하거나 삭제하도록 선택할 수 있습니다. For more information, see Codespace 중지 및 시작.
Deleting a codespace
You can create a codespace for a particular task and then safely delete the codespace after you push your changes to a remote branch.
If you try to delete a codespace with unpushed git commits, your editor will notify you that you have changes that have not been pushed to a remote branch. You can push any desired changes and then delete your codespace, or continue to delete your codespace and any uncommitted changes. You can also export your code to a new branch without creating a new codespace. For more information, see 분기로 변경 내용 내보내기.
Codespaces that have been stopped and remain inactive for a specified period of time will be deleted automatically. By default, inactive codespaces are deleted after 30 days, but you can customize your codespace retention period. For more information, see Codespace의 자동 삭제 구성.
If you create a codespace, it will continue to accrue storage charges until it is deleted, irrespective of whether it is active or stopped. For more information, see GitHub Codespaces 청구 관련 정보. Deleting a codespace does not reduce the current billable amount for GitHub Codespaces, which accumulates during each monthly billing cycle. For more information, see GitHub Codespaces 사용량 확인.
For more information on deleting a codespace, see Codespace 삭제.
Losing the connection while using GitHub Codespaces
GitHub Codespaces is a cloud-based development environment and requires an internet connection. If you lose connection to the internet while working in a codespace, you will not be able to access your codespace. However, any uncommitted changes will be saved. When you have access to an internet connection again, you can connect to your codespace in the exact same state that it was left in. If you have an unstable internet connection, you should commit and push your changes often.
If you know that you will often be working offline, you can use your devcontainer.json
file with the "Dev Containers" extension for VS Code to build and attach to a local development container for your repository. For more information, see Developing inside a container in the Visual Studio Code documentation.