Skip to main content
Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Using GitHub Codespaces in your repository

Using a codespace to make changes which is a development environment that's hosted in the cloud

Setup a codespace on a new branch

1 - Create new branch

It is always a good idea to create a new branch for any changes instead of checking directly into the main/master branch.</br> In the following example I typed the branch name add-large-pdf and then click Create branch: add-large-pdf Create a new branch

2 - Create a codespace in the new branch

Click the <> Code button </br> Create codespace

This will pop-up a new window and you will see the following screens

Codespace creation part 1 Codespace creation part 2

3 - Adding files to the repository in your codespace

Adding/uploading a file to your workspace

Once files are uploaded you will see them in the tree on the left</br>

File has been uploaded

4 - Commit files to the repository

Select the git symbol on the left</br> Git

Committing changes

  1. Click the +
  2. Type in a commit message
  3. Click Commit

Commit dialog complete

5 - Syncing/pushing changes to your branch

Click Sync Changes</br> Syncing/Pushing changes

Confirmation dialog

Once the sync is complete everyone can access the files you added from the new branch you created

Finding your codespaces you created

Go to codespaces

You will see detail and actions you can take about your codespace you created

Confirmation dialog

Actions that can be done with your codespace

Rename, export changes, change machine type, Keep codespace, Stop codespace</br>

Confirmation dialog

Open your codespace in a browser window

Confirmation dialog

Storing a codespace configuration in your repository

Create a file in the root of your repository .devcontainer/devcontainer.json.</br>

Basic example

{
  "name": "Codespace devcontainer config for the va.gov-team repository",
  "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
}

Large repository with LFS enabled and storing large binary files

Below is an example of a codespace that is used for the following:

  • Large repository
  • Stores binary files
  • LFS enabled
{
  "name": "Codespace devcontainer config for the va.gov-team repository",
  "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
  "hostRequirements": {
   "cpus": 8,
   "memory": "16gb",
   "storage": "32gb"
  }
}

Learn more

For more information on GitHub Codespaces and how to use them, please see GitHub Codespaces Docs.

Return to Guides