Note: Codespaces is currently in limited public beta and subject to change. For more information about joining the beta, see "About Codespaces."
About codespace creation
You can create a codespace on either GitHub.com or in Visual Studio Code. Each codespace you create is only available to you. No one else can work in your codespace.
Codespaces are associated with a specific branch of a repository and the repository cannot be empty. You can create more than one codespace per repository or even per branch. However, each user account has a five-codespace limit during limited public beta. If you've reached the limit and want to create a new codespace, you must delete a codespace first. For more information, see "Deleting a codespace."
When you create a codespace, a number of steps happen to enable full access to your development environment.
- Resources such as a VM and storage for your container are assigned. A new VM is created every time you create or start a codespace to ensure that you always have the latest versions and security patches.
- Codespaces receives information about your repository, branch, commits, your public dotfiles repository, and any secrets that you have created.
- Codespaces executes a shallow clone of the repository.
- If you have one in your repository, Codespaces runs the
devcontainer.json
file. For more information, see "Configuring Codespaces for your project." - Your Docker container,
docker-compose
, or other initialization is run. - At this point, the codespace is marked as available and you can connect.
- Once the codespace is made available, depending on the commands in the devcontainer, the codespace will continue with some set up.
- The codespace shares ports added in the
devcontainer.json
file. - The codespace runs anything specified in
postCreateCommand
. - Codespaces clones your dotfiles repository to the codespaces environment and looks for an install file. For more information, see "Personalizing Codespaces for your account."
- Finally, the codespace does a full clone of the repo so you have full access to it.
- The codespace shares ports added in the
You can edit code, debug, and use Git commands while developing in a codespace with Visual Studio Code. For more information, see the Visual Studio Code documentation.
You can see every available codespace that you have created at github.com/codespaces.
Creating a codespace
-
On GitHub, navigate to the main page of the repository.
-
Under the repository name, use the "Branch" drop-down menu, and select the branch you want to create a codespace for.
-
Under the repository name, use the Code drop-down menu, and select Open with Codespaces.
-
To create a codespace using a Standard machine type, click New codespace.