1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/content/codespaces/setting-up-your-project-for-codespaces/adding-a-codespaces-badge.md
Isaac Brown 31274d9415 [Universe] - Codespaces Templates - combined work (#32149)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: JP Ungaretti <19893438+jungaretti@users.noreply.github.com>
2022-11-03 13:30:55 +00:00

3.0 KiB

title, shortTitle, intro, allowTitleToDifferFromFilename, versions, type, topics
title shortTitle intro allowTitleToDifferFromFilename versions type topics
Adding an "Open in GitHub Codespaces" badge Add a Codespaces badge You can add a badge to a Markdown file in your repository which people can click to create a codespace. true
fpt ghec
* *
how_to
Codespaces
Set up

Overview

Adding an "Open in {% data variables.product.prodname_github_codespaces %}" badge to a Markdown file gives people an easy way to create a codespace for your repository.

Screenshot of a Codespaces badge on a README page

When you create a badge you can choose specific configuration options for the codespace that the badge will create.

When people click the badge they'll be taken to the advanced options page for codespace creation, with the options you chose preselected. For more information about the advanced options page, see "Creating a codespace for a repository."

From the advanced options page, users can change the preselected settings if required, then click Create codespace.

Creating an "Open in {% data variables.product.prodname_github_codespaces %}" badge

{% data reusables.repositories.navigate-to-repo %}

  1. Under the repository name, use the "Branch" dropdown menu, and select the branch you want to create the badge for.

    Screenshot of the Branch dropdown menu

  2. Click the {% octicon "code" aria-label="The code icon" %} Code button, then click the Codespaces tab.

    Screenshot of the New codespace button

  3. Click the down arrow at the side of the Create codespace on BRANCH button, click Configure and create codespace, then click the Configure and create codespace button.

    Screenshot of the "Configure and create codespace" option

  4. On the advanced options page for codespace creation, select the values you want to be preselected in each field.

    Screenshot of the advanced options page

  5. Copy the URL from the browser's address bar.

  6. Add the following Markdown to, for example, the README.md file of your repository:

    [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](COPIED-URL)
    

    For example:

    [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=0000000&machine=premiumLinux&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=WestUs2)
    

    In the above example, 0000000 will be the reference number of your repository. The other details in the URL are determined by the values you selected in the fields on the advanced options page.