Ends in
00
days
00
hrs
00
mins
00
secs
ENROLL NOW

💪 25% OFF on ALL Reviewers to Start Your 2026 Strong with our New Year, New Skills Sale!

GitHub Codespaces

Home » Others » GitHub Codespaces

GitHub Codespaces

GitHub Codespaces Cheat Sheet

GitHub Codespaces is a fully managed, cloud-hosted development environment that lets developers work directly from a GitHub repository using a containerized setup.

A codespace is:

  • A Docker container running on a dedicated virtual machine.

  • Preconfigured with source code, runtime, libraries, tools, and editor settings

  • Accessible through:

    • Browser-based VS Code

    • Local VS Code connected remotely

Each codespace is isolated, secure, and linked to a specific repository, branch, or commit.

TD_GitHub Codespaces_07Jan25

High-Level Architecture Components

Component

Description

Repository

Source of truth containing code and configuration

devcontainer.json

Defines environment, tools, extensions, and settings

Docker Image / Container

Runtime environment for development

Virtual Machine (VM)

Provides CPU, memory, storage, and networking

VS Code Interface

Primary IDE (web or desktop)

Dev Container Configuration (devcontainer.json)

The devcontainer.json file is the heart of Codespaces customization.

Common Configuration Elements

  • Base Image

    • Defines OS and preinstalled software

  • Features

    • Prebuilt modular tooling (e.g., Node.js, Python, Docker)

  • Extensions

    • VS Code extensions auto-installed

  • Settings

    • Editor settings scoped to the environment

  • Post-create Commands

    • Scripts that run after the container is built

  • Forwarded Ports

    • Expose services (web apps, APIs)

Purpose

  • Ensures environmental consistency

  • Eliminates “works on my machine” issues

  • Tutorials dojo strip
  • Enables team-wide reproducible development

GitHub Codespaces Features

Cloud-Based Development

  • Runs entirely on GitHub infrastructure

  • No dependency on local machine resources

  • Ideal for low-powered devices or locked-down corporate laptops

Fully Integrated IDE

  • VS Code Web:

    • Editor

    • Terminal

    • Debugger

    • Git integration

  • VS Code Desktop:

    • Same experience using Remote Development

Machine Types

Machine Type

Use Case

2-core
Lightweight development
4-core
Standard workloads
8+ core
Large builds, data processing

TD_GitHub Create Codespaces_07Jan25

Machine types of impact:

  • Performance

  • Cost

  • Build times

Port Forwarding

  • Automatically detects listening ports

  • Allows:

    • Private ports (default)

    • Publicly accessible preview URLs

  • Used for:

    • Web apps

    • APIs

    • Microservices

Prebuilds

Prebuilds proactively create codespaces environments:

  • The environment is built before a developer opens it

  • Reduces startup time dramatically

  • Especially useful for large repositories

GitHub Integration

  • Native Git support

  • Authentication via GitHub identity

  • Pull requests, issues, and branches are fully supported

TD_GitHub Codespaces _07Jan25

Secrets Management

Codespaces supports secrets at multiple levels:

Secret Type

Description

Repository secrets

Repo-specific credentials

Organization secrets

Shared across repos

User secrets

Personal tokens

Secrets are:

  • Injected securely

  • Never committed to source control

Collaboration

  • Live Share support

  • Share running applications via forwarded ports

  • Multiple codespaces can exist per user

GitHub Codespaces Lifecycle

Lifecycle Stage

Description

Key Characteristics

Creation

A new codespace is provisioned from a repository source.

  • Created from default branch, specific branch, commit SHA, or template repository

  • VM is provisioned

  • Container image is pulled or built

  • devcontainer.json is applied

  • Post-create commands are executed

Running

Codespace is active and ready for development.

  • CPU, memory, and storage allocated

  • Billing for compute is active

  • Background processes continue running

  • Closing the browser does not stop the codespace

Stopped

Codespace is paused due to inactivity or manual action.

  • Compute resources are released

  • File system and data persist

  • Billing for compute stops

  • Storage billing continues

Restarting

A stopped codespace is resumed.

  • Files, environment, and Git changes remain intact

  • No rebuild unless configuration changes

  • Services and tools resume from previous state

Deletion

Codespace is permanently removed.

  • VM and container are destroyed

  • Local uncommitted changes are lost

  • Lifecycle ends permanently

  • Cannot be recovered

Security Model

  • Each codespace runs in:

    • A dedicated VM

    • Isolated network namespace

  • Authentication uses GitHub identity

  • Repository permissions apply

  • No inbound access unless ports are forwarded

Cost & Billing Model

Billing is based on:

  • Compute Time

    • While codespace is running

  • Storage

    • Persisted disk usage

Cost depends on:

  • Machine size

  • Duration

  • Number of active codespaces

 

Conclusion

GitHub Codespaces provides a secure, reproducible, and fully managed cloud development environment that eliminates the complexity of local setup. By combining containerization, GitHub-native integration, and VS Code tooling, Codespaces enables faster onboarding, consistent environments, and scalable development workflows. Understanding its architecture, lifecycle, security model, and billing behavior is critical for both real-world usage and exam scenarios.
 

References

https://docs.github.com/en/codespaces/about-codespaces/what-are-codespaces

https://docs.github.com/en/codespaces/about-codespaces/codespaces-features

https://docs.github.com/en/codespaces/about-codespaces/understanding-the-codespace-lifecycle

💪 25% OFF on ALL Reviewers to Start Your 2026 Strong with our New Year, New Skills Sale!

Tutorials Dojo portal

Learn AWS with our PlayCloud Hands-On Labs

$2.99 AWS and Azure Exam Study Guide eBooks

tutorials dojo study guide eBook

New AWS Generative AI Developer Professional Course AIP-C01

AIP-C01 Exam Guide AIP-C01 examtopics AWS Certified Generative AI Developer Professional Exam Domains AIP-C01

Learn GCP By Doing! Try Our GCP PlayCloud

Learn Azure with our Azure PlayCloud

FREE AI and AWS Digital Courses

FREE AWS, Azure, GCP Practice Test Samplers

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

Follow Us On Linkedin

Written by: Ace Kenneth Batacandulo

Ace is AWS Certified, AWS Community Builder, and Cloud Consultant at Tutorials Dojo Pte. Ltd. He is also the Co-Lead Organizer of K8SUG Philippines and a member of the Content Committee for Google Developer Groups Cloud Manila. Ace actively contributes to the tech community through his volunteer work with AWS User Group PH, GDG Cloud Manila, K8SUG Philippines, and Devcon PH. He is deeply passionate about technology and is dedicated to exploring and advancing his expertise in the field.

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?