Skip to content

GitHub and Git

OpenSAFELY uses GitHub to store the code used to create and analyse the study data. GitHub is based on git, an industry-standard version control system that helps multiple contributors manage and share code effectively. GitHub also supports convenient publication of your code, so that anybody can view it, comment on it, and use it themselves. We require that anyone who uses OpenSAFELY publish their code on publication of their papers.

A good starting point for understanding version control in the context of scientific research has been written by The Turing Way collaborative. If you are completely new to these concepts or want to understand more then we suggest reading through their chapter on version control.

To get set up, you will need:

  • A GitHub account
  • git installed on your local machine

New to git🔗

For Windows or macOS users new to git, the easiest way to do both is to install GitHub Desktop. This includes a command line version of git and a useful GUI for editing files and gitting. To install GitHub Desktop, visit the GitHub Desktop homepage and click install for your operating system. Once installed, it will ask you to create or sign-in to your GitHub account. Follow the instructions as appropriate.

Once signed in, you'll be taken to a Let's get started page. You'll need to install other OpenSAFELY requirements before diving in.

Old to git🔗

If you already have git installed and prefer using your existing git workflow, then this is fine.

If you're not sure if you already have git installed, type git --version into any command line terminal.

Access to the OpenSAFELY GitHub organisation🔗

This is only necessary for running code against the real data. Ask us for access. If you're not sure if you already have access, go to Settings > Organizations in GitHub and see if opensafely is listed.

You will need two-factor authentication (2FA) for your GitHub account to join the organisation. This provides extra security for your account by requiring something you have (for example, an authenticator application on your phone) as well as something you know (your password).

To set up 2FA, follow these instructions. If you're not sure if you already have 2FA enabled, go to Settings > Security > Two-factor authentication in GitHub and check that at least one method is Configured.