title | intro | versions | type | topics | shortTitle | redirect_from | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Creating a codespace from a template |
If you're starting a new project, you can create a codespace from a blank template or choose a template specially designed for the type of work you want to do. |
|
how_to |
|
Create a codespace from a template |
|
{% ifversion ghec %}
{% data reusables.codespaces.data-residency-availability %}
{% endif %}
If you're starting a new project, you can get started with development work quickly by creating a codespace from a template. You'll be able to work on your project in a cloud-based development environment, save your files in the cloud, and publish your work to a new remote repository that you can share with others or clone to your local machine.
You can start from a blank template, choose from templates maintained by {% data variables.product.company_short %} for popular technologies such as React or Jupyter Notebook, or launch a codespace from any template repository on {% data variables.product.prodname_dotcom %}.
{% ifversion ghec %}
Note
If you have a {% data variables.enterprise.prodname_managed_user %}, you cannot use {% data variables.product.company_short %}'s public templates for {% data variables.product.prodname_github_codespaces %}, because you can only create codespaces that are owned and paid for by your organization or enterprise. For more information, see AUTOTITLE.
{% endif %}
With a blank template, you'll start with an empty directory, with access to cloud-based compute resources and the tools, languages, and runtime environments that come preinstalled with the default dev container image. With other templates, you'll get starter files for the technology you're working with, plus typically some extra files such as a README file, a .gitignore
file, and dev container configuration files containing some custom environment configuration. For more information on dev containers and the default image, see AUTOTITLE.
As an example, if you create a codespace from {% data variables.product.company_short %}'s React template, you'll arrive in a workspace containing template files for a simple application, such as index.js
, app.js
, and package.json
. Shortly after the codespace opens, a development server will start up automatically, and you will be able to view the running application in a simple browser tab within the {% data variables.product.prodname_vscode_shortname %} web client.
The files and configuration included in templates are defined in template repositories. The template repository is cloned into your codespace when you create the codespace. After that, the link is severed, and your codespace won't be linked to a remote repository until you publish to one.
Tip
To help people get started with your framework, library, or other project, you can set up a template repository for use with {% data variables.product.prodname_github_codespaces %}. For more information, see AUTOTITLE.
Templates maintained by {% data variables.product.company_short %}, including the blank template, are available from the "Your codespaces" page.
{% data reusables.codespaces.your-codespaces-procedure-step %} {% data reusables.codespaces.view-all-templates-step %}
-
Optionally, to view the template repository containing the files for a template, click the name of the template.
-
Under the name of the template you want to launch, click Use this template.
{% data reusables.codespaces.template-codespaces-default-editor %}
You can create a codespace from any template repository, then publish your work to a new repository when you are ready. For more information on template repositories, see AUTOTITLE.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.codespaces.use-this-template %}
Note
If you're a maintainer of the template repository, and want to commit changes to the template repository itself, you should create a codespace from the {% octicon "code" aria-hidden="true" %} Code dropdown. For more information, see AUTOTITLE.
{% data reusables.codespaces.template-codespaces-default-editor %}
{% data reusables.codespaces.about-publishing-templates %}
{% data reusables.codespaces.publishing-template-codespaces %}
When a codespace is published, you have access to a greater range of options to customize your {% data variables.product.prodname_github_codespaces %} experience. For example, you can:
- Change the machine type of your codespace to make sure you're using resources appropriate for the work you're doing (see AUTOTITLE).
- Allow {% data variables.product.prodname_dotcom %} to automatically use GPG to sign commits you make in your codespace (see AUTOTITLE).
- Share secrets with your codespace (see AUTOTITLE).
You can publish an unpublished codespace from the "Your codespaces" page on {% data variables.product.github %}. This is useful if you want to publish a codespace that you don't currently have open in your browser. If you do this, your work will be preserved in a repository, but there won't be a link between your existing codespace and the new repository. However, you can navigate to the new repository and create a codespace from there, and this codespace will be connected to the repository.
{% data reusables.codespaces.your-codespaces-procedure-step %}
-
Next to the unpublished codespace, click the ellipsis (...), then select Publish to a new repository.
-
Choose a name for your new repository, set it as Public or Private, and click Create repository.
-
Optionally, to view the new repository, click See repository.