Skip to content

4. Set up Git and GitHub

Eli Holmes edited this page Dec 1, 2021 · 1 revision

Install jupyterlab-git

Note this was installed in the environment set so shouldn't be needed here.

Login to the JupyterHub (as admin). Install jupyterlab-git This is a UI to Git for JupyterLab. This installs Git too.

sudo conda install -c conda-forge jupyterlab-git

Note this is in the environment.yml so installation might already be done.

Users set up their accounts

Then you need to set-up the GitHub account for a user (not admin). Each user will need to do these steps individually. Follow the instructions here https://nasa-openscapes.github.io/2021-Cloud-Hackathon/clinic/notebooks.html

  1. Create a GitHub token for credentials https://github.com/settings/tokens/new. Copy the token because you won't see it again. You'll use it later.

  2. Login to the JupyterHub not at admin and open a terminal (in notebook, it is in the top right under 'new'). Run this code (replace with your username and email).

git config --global user.name "<your github username>"
git config --global user.email "<your email>"
  1. Set up to store credentials
git config --global credential.helper store
  1. Clone a repo (your OWN repo). Basically go to one of your repos and copy the URL you see in the browser.
git clone <github repo url>
  1. Open the repo (in JupyterLab say) and make a change to a file. Use the Git UI, to commit the change and push. When it asks for credentials, enter GitHub username and the TOKEN

Done!!