Author: April Edwards (LinkedIn)
Bio: April is a senior enterprise advocate and platform engineering lead at GitHub, specializing in application transformation and DevOps ways of working. Her focus is to take customers of a journey from legacy technology, to serverless and containers, where code comes first, while enabling them to take full advantage of DevOps.
“But it works on my machine!” That is one of the most classic lines that any developer, project manager or IT professional has ever heard. We work in a world with an overwhelming amount of hardware options to write our code. But the current way is inconsistent in terms of configuration and security. What if our teams could work more effectively?
Think of the last time you onboarded into another team, or started a new project. You probably had a list of packages to install, issues with missing dependencies, incorrect versions, installation issues, and even device specific configuration issues (different operating systems, too much/too little compute or RAM, applications or processes that interfere with the work you need to do).
These are blockers to being truly cloud native and agile. In some cases, it can take days or even weeks to just get started and write some code.
What if every developer could work from a consistent environment without having to worry about individual configurations or inconsistent specifications? We know about application code, infrastructure as code and pipelines as code. What about developer environments as code?
Dream no longer, as GitHub Codespaces can help you do exactly that. With GitHub Codespaces you have the power to code from any device, onboard developers within minutes and work entirely from a secure environment that is completely scalable! And the best bit? In November of last year, we announced that free and pro accounts are entitled to a free allowance of GitHub Codespaces.
I have worked on many projects where onboarding can take days or even weeks (That was our first- hand experience at GitHub until we moved the engineering team onto Codespaces). But there can still be barriers. Think about all the requirements and dependencies to run tests locally on your machine. Or, your fellow developers working on a different architecture (such as ARM64 or Apple Silicon).
There are many variables that affect how we write code. Fortunately, templating our development environments helps us mitigate those blockers. It helps us get to productivity in developing our cloud native apps faster, more efficiently, all in a cloud native way.
What is GitHub Codespaces?
GitHub Codespaces takes the next step past Infrastructure as Code (IaC) and could be considered as your Development Environment as Code. As they’re template based, they’re an easy way to help you get started on any project.
They are a hosted (containerized even – yes, truly cloud native) developer environment that works just like your local editor. You can use Codespaces through your web browser, Visual Studio Code, JetBrains or JupyterLab. As they’re backed by containers (so, compute), you have access to the editor, terminal, debugger and version control. You can even sync settings across devices, and use dotfiles to ensure your environment is just how you like it.
With GitHub Codespaces, your repository contributors can set up the exact same environment with pre-installed dependencies at the click of a button.
Codespaces is based on the concept of a devcontainer. This is the template used to easily and consistently reproduce your development environment.
A dev container is a containerized environment that allows you to run a completely custom development environment that includes all of the tools and runtimes that you need to work on your specific project. It allows your developers to get started fast with all of the tools they need and work in a secure environment.
Getting started with GitHub Codespaces
There are a few ways to get started. You can either use one of your GitHub repositories that contains your existing code, or you can start with our helpful beginners guide to help you get going.
To use GitHub Codespaces on an existing GitHub repository:
1) Open a web browser and go to: https://github.com/login. Login to your account:
2) Browse to the repository where your code is stored, and that you would like to work on.
3) On the right hand side of your screen, select ‘code’.
4) Then select ‘create codespace on main.’ This will create the Codespace based on your main branch. But you can also switch branches once the Codespace is active.
5) Your GitHub Codespace will load up in seconds to minutes (you likely won’t even have time to make a cup of coffee)! If needed, you can customize your Codespace by selecting the three dots above the green ‘Create Codespace on main’ button that you clicked earlier. This allows you to setup a custom pre build (for even quicker startup times), or configure your Codespace to your liking!
Do more with GitHub
There are endless configurations and ways to get started using Codespaces. You can find our full documentation here. With GitHub Codespaces, you can use languages like Java, C#, Python and Go… just to name a few. You’ll find code samples in our example guides to help you get started quickly and find custom configurations for the language that you’re working in.
Have you already worked with GitHub Codespaces? Then you may want to check out ten things that you didn’t know that you could do with GitHub Codespaces. I also use GitHub Copilot as my AI pair programmer for a bit of rubber ducking when I’m in my development flow.
Get started developing your cloud native apps faster and in a more cloud natively way.