After coming home with Microsoft, more and more good and free things come to GitHub. This time, a long awaited features are in beta, invitation only, and it is GitHub Codespaces

1. Extremely short introduction

Codespaces, in short, is a Linux virtual machine running vscode server, and allow you to access it via any web browser.

Microsoft introduce it codespaces first in Visual Studio Online, using your Azure account to charge. GitHub codespaces is in early access stage, so everything is free for now.

To request early access GitHub codespaces, here is the link: https://github.com/features/codespaces

2. Using GitHub codespaces

When you’re invited to use codespaces, your GitHub’s repositories will have another options in open button

open button

2.1. Change theme

The default theme for VSCode is light. Light attracting bugs. So we need to change it dark

The normal themes used by vscode is not worked, so we need to use an extension developed by GitHub called github theme

themes

Sadly, the icon theme is fixed with 1 of the 2 default set.

2.2. Settings

Except some settings related to themes and icon that have no effect, almost all other settings are the same. You can just copy and past the settings from your local vscode to codespaces vscode

2.3. Install your programming language extensions

I think every programming language extension worked as it should be, but first, you will need to setup the development environment in Linux.

For example, to use Java, you will need to install JDK on linux, then Java Extension Pack for a complete list of Java extensions in vscode.

C/C++ and Python extension are pre-installed

When you open a project, based on the language, some language extension will be pre-installed

2.4. Work with multiple repository

By default, 1 codespaces can only work with 1 repository. I will use SSH key to have access to every repositories on my Github.

  1. Generate SSH key
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  1. Add ssh key to ssh agent
$ eval "$(ssh-agent -s)"
> Agent pid xxxxx
$ ssh-add ~/.ssh/id_rsa
  1. Add the public key to GitHub

Add the key to settings at SSH settings

  1. Change repo remote URL from HTTPS to SSH
git remote set-url origin git@github.com:<Username>/<Project>.git

That’s it

3. Some interesting things I found

  • The codespaces running on Debian 9.13 – lsb_release -a
  • 4GB of RAM – free -m
  • Using 2 core of the Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz – less /proc/cpuinfo and cat /proc/cpuinfo | grep processor | wc -l

The vscode version is the latest Insider version, so expect some errors and unstable features

One thought on “GitHub codespaces – write code in web browser

Leave a Reply to Híp Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.