Skip to content

Create a GitHub codespace

For the repository you just created, there is a Code button on GitHub.

To open your repository with GitHub Codespaces:

  1. Click the Code button.
  2. Click the Codespaces tab.
  3. Click the "Create codespace on main". The screenshot below shows this.

A screenshot showing the "Create codespace on main" button.

You may see the following screen requesting additional permissions for your Codepsace:

A screenshot showing "This codepsace is requesting additional permissions, with a green 'Authorize and continue button at the bottom right".

If so, click "Authorize and continue".

You should then see a "Setting up your codespace" screen:

A screenshot showing "Setting up your codespace".

A GitHub codespace containing the Visual Studio Code editor with a command-line interface "terminal" should then appear. This may take a little bit longer the first time a codespace is started, perhaps a minute or two.

GitHub's codespace showing the editor, terminal and
Explorer.

The terminal at the bottom-right of the GitHub codespace runs commands on a computer (virtual machine) provided by GitHub.

The large, upper-right area holds the main editor, which is where you will view and edit files that you are working on. The left "side bar" holds the Explorer when you first start the codespace. There are other useful menus in this area that can be accessed with the icons to the far left side. Finally, the button at the top-left with three horizontal lines () is the menu button, which allows you to access many more options.

If you find yourself using GitHub regularly for working on research, we have more information on working with GitHub codespaces.

Running opensafely🔗

The opensafely software should already be installed if you start a GitHub codespace for the OpenSAFELY research template.

You can confirm this by typing opensafely in the terminal at the prompt $ and pressing Enter. You should see an output that looks something like:

$ opensafely
usage: opensafely [-h] [--version] COMMAND ...

optional arguments:
  -h, --help  show this help message and exit
  --version   show program's version number and exit

available commands:

  COMMAND
    help      Show this help message and exit
    run       Run project.yaml actions locally
    codelists
          Commands for interacting with https://codelists.opensafely.org/
    pull      Command for updating the docker images used to run OpenSAFELY studies locally
    upgrade   Upgrade the opensafely cli tool.