Overview
Adding an "Open in GitHub Codespaces" badge to a Markdown file gives people an easy way to create a codespace for your repository.
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 GitHub Codespaces" badge
-
On GitHub.com, navigate to the main page of the repository.
-
Under the repository name, click the button labeled with the name of the current branch and, in the dropdown menu, select the branch you want to create the badge for.
-
Click the Code button, then click the Codespaces tab.
-
At the top right of the Codespaces tab, select and click New with options.
-
On the advanced options page for codespace creation, select the values you want to be preselected in each field.
-
Copy the URL from the browser's address bar.
-
Add the following Markdown to, for example, the
README.md
file of your repository:Markdown [](COPIED-URL)
For example:
[](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.