The pace at which apps are being built today demands speed, collaboration, and flexibility in software development. GitHub Codespaces enables this by solving an age-old problem of setting up your environment. Instead of spending hours searching for tools and dependencies, you can directly launch a full dev setup in the cloud in just a few clicks. Since it works right with GitHub repositories, Codespaces makes it easier to get started and get going. It also supports remote work and maintains consistency across different setups, making it a powerful tool for individuals, teams, and open-source contributors. In this article, we will learn all about GitHub Code spaces, including its features, applications, pricing, and how to use it for free.
GitHub Codespaces is a cloud-based development environment that runs inside Docker containers on virtual machines. This allows you to write code directly on your browser or through Visual Studio Code, without the need to install anything locally. Each codespace runs on a Linux environment and can be set up using configuration files defined in your repository. This practice is known as Configuration-as-Code.
On GitHub Code spaces, you can start a codespace from a template or any branch of a repository, making it easy to keep work organised and consistent. It lets you customise tools and runtimes using dev containers, and set personal preferences using Dotfiles. Setting Sync can further make the experience just like your local VS Code. Moreover, it makes your dev setup easy and repeatable, helping you start coding fast and from anywhere.
Also Read: Introduction for Git and Github for Beginners
Here are some of the key features offered by GitHub Codespaces:
Understanding the lifecycle of Codespaces on GitHub is essential to be able to manage your work from creation to deletion. The lifecycle starts when you create a codespace and ends when you delete it. During its lifetime, you can disconnect or reconnect anytime without losing your running processes. To make it clearer, stopping and restarting a codespace won’t remove your saved changes.
On GitHub, you can choose to start a fresh codespace or open an existing one. Some developers prefer creating a new one for every session, while others keep a long-running codespace for continuous work. The platform also gives you the option to create a codespace from a template.
However, there are limits to how many codespaces you can create or run at once. If you hit the limit, you’ll need to delete or stop an existing one to make space to start a new codespace. If you’re using new codespaces often, I advise you to push your commits to GitHub frequently, to ensure there’s always room for new codespaces. And for long-running ones, always pull the latest code before you begin working.
The web-based version of GitHub Code spaces has auto-save on by default, so saving your changes is never a problem. But if you’re using it on VS Code on your desktop, you’ll need to manually enable auto-save. All the work is saved on a cloud VM, which lets you stop at any point and return to it later. The platform even prompts you to save any unsaved changes before exiting. But if you delete the codespace, all the work done in it is lost unless committed and pushed.
Inactive codespaces timeout after 30 minutes by default. You can change this setting from the settings panel. But there’s nothing to worry about a timeout, since the data saved until then remains intact.
If you update your dev container configuration, you can rebuild the codespace. By default, GitHub uses cached images to rebuild the codespace. However, if you want to start from a clean environment, you can choose to do a full rebuild instead. Keep in mind that only files inside the /workspace folder are saved; everything else will be reset during the rebuild. You can also choose to do a full rebuild to start fresh.
You can stop a codespace at any time. When you stop it, all processes stop, but your saved work stays. Terminal history also stays. Just closing the browser tab doesn’t stop it. It still runs in the cloud, and you’ll be charged while it’s running. And to stop the codespace, you can follow the steps below:
After pushing your changes, you can safely delete the codespace. Deleting a codespace is pretty simple once you’re done working; just make sure you pushed your changes on GitHub first so you don’t lose anything. If there are any uncommitted changes, GitHub will ask you to either push or export them before deleting. Also, stopped codespaces get deleted automatically after 30 days by default. But just keep in mind, even after deletion, a codespace might still count toward billing until the cycle ends.
GitHub Codespaces needs an internet connection to run. So, if you lose access to the internet, you cannot use the codespace. But luckily, the unsaved changes would still be there. So, once you’re reconnected, you can resume from the same state. If you have an unsteady connection or plan to work offline often, I advise you to use a local container with the Dev Containers extension and your devcontainer.json.
Now let’s see how we can work with GitHub Codespaces. Instead of starting from scratch, let’s just create a codespace from a template repository. In this walkthrough, we’ll be using the browser-based version of VS Code, which is the default editor for Codespaces. If you want, you can switch later to another editor and change the default settings if needed.
So in this step we will create a new codespace using ready-made GitHub template. This will help us quickly start or create a development environment without setting up anything on the local machine.
This clones the template into your new codespace automatically.
In this step, we’ll run the application to see how it works. This lets us test the changes live right from within the platform.
From the image below, you can see that the terminal is ready. Now let’s run the application.
In this step, we will edit the content of the project and see the changes live. This will help us understand how real-time updates work inside a codespace.
Now that we have made a few changes, we can push them onto GitHub. For this:
Now that we’ve learned how to use GitHub Codespaces, let’s find out how much it would cost us to use it. GitHub provides a flexible pricing model based on storage and compute time, as shown below:
Plan | Included Usage |
Additional Cost |
Free for Individuals | 60 hours/month(for basic Linux compute) | $0.18 per additional hour |
GitHub Team/Enterprise | Varies by plan |
Pay as you go or paid hours |
As mentioned in the table, GitHub Codespaces is free for individual users with 60 hours of standard compute time per month and up to 15 GB of storage, which makes it a great choice for hobby projects, learning, or testing workflows without any upfront cost. And even beyond the free tier, GitHub offers usage-based pricing, which ensures that you only pay for what you use.
Github Codespaces is ideal for many tasks, such as:
If you have used GitHub before, you might have seen GitHub.dev and thought about how it is different from GitHub Codespaces. Although they may seem similar, they serve very different purposes.
Work in GitHub.dev is not saved unless you commit; once you close it, your unsaved work is gone. But in Codespaces, your progress stays saved even after you close it. Also, Codespaces works with full IDEs like VS Code or JetBrains, and lets you sync settings between local and cloud. This is a much better option for big projects and teamwork.
Now let’s compare the two based on various features:
Feature | GitHub.dev |
GitHub Codespaces |
Use case | Quick edits | Full development |
Setup | No setup needed | Ready-made container with tools |
IDE Support | Basic editor | Supports VS Code, JetBrains, Jupyterlab |
Custom Options | Very limited | Highly flexible |
Resources | No resource use | You manage the compute and storage |
Deployment | Not for deployment | Supports full deployment |
Access | Works for all repos | Needs a paid plan and more resources |
GitHub Codespaces is a game-changer in the way developers approach coding. By eliminating setup difficulties and offering a powerful, cloud-based development environment, it streamlines workflows and boosts productivity. Whether you are working alone, collaborating in a team, or just getting started as a student, Codespaces ensures a fast, consistent, and flexible experience. With features like in-browser development, full IDE support, and seamless integration with GitHub repositories, it empowers developers to focus more on building and less on configuration. Simply put, this platform redefines modern development for the better.