import gh_scoped_creds
%ghscopedcredsUsing DataHub as a commmon computational environment
While in principle, it’s fine to use your laptop, it will be hard for us to diagnose all the different problems that might arise with so many participants. So we recommend using a common computational environment during the workshop. We’ll use the Berkeley DataHub for this, with is a JupyterHub provided by UC Berkeley. You can think of DataHub as providing user-specific virtual machines with identical software for all of us to use.
The exception is that if you already have experience using your laptop with the shell/terminal, Git (and pushing to GitHub) and Python.
Click here to access your own machine/server with Python, git, and terminal access on the campus DataHub (also used for various data science, CS, and statistics courses).
Note that in 2026, we are using stat.datahub.berkeley.edu not datahub.berkeley.edu because of some issues with Git authentication.
Do NOT go directly to stat.datahub.berkeley.edu the first time you are accessing DataHub. If you do, you won’t have the repository materials available in your virtual machine.
That will get you onto your server with the materials for the course, from the berkeley-scf/compute-skills-2026 repository available on the server.
Check your environment
To check things look good:
- Click on
Terminal(in the 3rd row of theLaunchertab, underOther). (If you have trouble finding the Terminal, go toFile->New->Terminal.) - Run
cd ~/compute-skills-2026(this may already be your current directory, in which case this step is not needed). - Run
lsto see the files in the repository.
Editing files
You can combine text and code in a notebook, which you can start with:
New Launcher->Notebook->Python 3 (ipykernel), orFile->New->Notebook
To run the code in a cell, a shortcut is Ctrl + Enter/Return.
To create a script file containing just code, do File -> New -> Python file.
Stopping your server
You can stop your server via File-> Hub Control Panel -> Stop My Server.
If you only log out, any ongoing computations will still run in the background.
Accessing GitHub repositories from DataHub
(These instructions are needed only for the main sessions of the workshop, Wednesday and Thursday.)
If you don’t already have a GitHub account, please sign up for one.
Please don’t do the steps in this section until after we do the exercise where you create your newton-practice repository.
Authenticating with GitHub can be a bit tricky, particularly when using DataHub (i.e., JupyterHub).
If you’re doing all your work on your laptop and not using DataHub at all and if you’re already set up to use GitHub, you don’t need to do the steps in this section.
But if you’re using your laptop and not set up to use GitHub, these instructions should work there too (it may also depend on the version of git you are using; e.g., version 2.34.1 is too old but 2.39 should be fine). You’ll need to install gh-scoped-creds via pip install.
That said, if you haven’t already used Git on your laptop and successfully pushed changes up to GitHub in the past, it’s best if you work in DataHub so that we don’t have to troubleshoot laptop issues for multiple participants.
We’ll use a tool (an ‘app’) that helps us with this, provided in the gh_scoped_creds Python package.
You must do all three steps in order to be able to interact with your GitHub repository from DataHub.
1. Configure git
First configure git in the terminal:
git config --global user.name "Your Name"
git config --global user.email "your_name@berkeley.edu"
git config --global color.ui "auto"
git config --global pull.rebase falseThat will modify your ~/.gitconfig file.
2. Give DataHub access to your GitHub account
Then run this in the terminal:
gh-scoped-credsOr you could instead run this in IPython or Jupyter Notebook:
Then follow these steps:
- When you run
gh-scoped-credsabove, you’ll see a link to https://github.com/login/device and a code. - Go to that link in a browser (on your laptop, outside of DataHub) and login to GitHub (or click
Continueif already logged in). - Input the code, and click
Authorize Berkeley-DataHub-Git-Access. This will grant access to GitHub from DataHub (i.e., JupyterHub) for 8 hours (or until you stop your JupyterHub server).
3. Give access to the specific GitHub repository you are working with
Then (only the first time you are doing all this):
Go to the URL that is printed out in your terminal (which should be https://github.com/apps/berkeley-datahub-git-access) and click on
Installin the upper right.(For those who have access to multiple GitHub organizations) Choose your personal org, namely your GitHub username.
In the “Install Berkeley DataHub Git Access” interface that appears, choose
Only select repositoriesand select the repository you are using for the workshop, namely<username>/newton-practice. (For some reason, the searching functionality seems to not be robust, so you may need to type the full repository name.) Then clickInstall. That should take you to a screen showing that you’ve given access to the repository.Authenticate with GitHub using a one-time password or your GitHub password.
If you run git push and get a permission denied or 403 error or Git asks for a password, something has gone wrong with one of the three steps above.
Backup option for accessing GitHub repositories using a Personal Authentical Token (optional)
If you run into trouble with the above steps, here is a work-around that involves setting up your own personal authentication token (PAT) to use as a password.
Steps:
- Log in to your account the GitHub website (this accepts your standard GitHub password).
- Go to
github.com/settings/tokens. - Click
personal access tokens, and under the dropdown clickTokens (classic). - Click
Generate new tokenandGenerate new token (classic)from the dropdown. - Give the token a name in the
Notesection, select how long you want the token to be active for, and underSelect scopesclick therepocheckbox. - The token will appear in a green box (it will be a long sequence of letters and numbers). Make sure to copy and store it somewhere safe! This is the only time GitHub will ever tell you what that PAT is.
These steps only need to be done once (or for as long as you made your token active). Each time you need to push to the DataHub and you are prompted for a username/password, use this as your password!