Intro
GitHub Codespaces is a cloud-based IDE powered by VS Code that lets you start coding instantly, either in your browser or in local VS Code, with no local setup required.
How it works
![]()
Each codespace you create is hosted by GitHub in a Docker container, running on a virtual machine. You can choose from a selection of virtual machine types, from 2 cores, 8 GB RAM, and 32 GB storage, up to 32 cores, 128 GB RAM, and 128 GB storage.
- When you launch a Codespace, GitHub spins up a virtual machine (VM) in the cloud.
- Inside that VM, your project runs in a Docker container (defined by
.devcontainer). - The container holds all your dependencies, tools, and extensions.
- VS Code (browser or local) connects to this container so you can edit, build, and run code.
References
Setup
- Open a repository in GitHub.
- Click Code → Open with Codespaces → New codespace.
- GitHub spins up a container with your project and dev tools.
- Start coding immediately; all dependencies and environment settings can be preconfigured with
.devcontainer.
Enable Clipboard Access in Firefox
To allow the GitHub Codespaces terminal to access the clipboard in Firefox, set
dom.events.testing.asyncClipboard → trueinabout:config.
Devcontainer Basics
You can use devcontainer/devcontainer.json Lifecycle Scripts to define the container, tools, and startup commands.
postCreateCommand: Runs once when the codespace is first created. Ideal for heavy installations like .postStartCommand: Runs every time the codespace is started (after it was stopped). Use this for starting development servers or background processes.postAttachCommand: Runs every time a user connects (attaches) to the codespace.
Example configuration
{
"name": "My Project",
"image": "://mcr.microsoft.com",
"postCreateCommand": "npm install",
"postStartCommand": "npm run start"
}


