Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Loading Files onto the Hub

nbgitpuller gives a whole class a copy of your materials from one link. A student clicks it, the files land in their own space on the hub, and the notebook you pointed at opens. Nobody needs to know git.

Setting this up takes two things: your materials in a public GitHub repository, and a link that points at them.

Put your materials in a public repo

Go to GitHub and choose New.

The GitHub dashboard with a green New button next to the Top repositories heading.

Start from the New button on your GitHub dashboard.

Pick an owner, which can be your personal account or an organization your course uses, and name the repository. Set Choose visibility to Public, then create it.

The Create a new repository form, with owner and repository name filled in and visibility set to Public in the Configuration section.

Visibility has to be Public for students to pull from the repository.

Add your notebooks and data files with Add file, then Upload files.

A newly created public repository with the Add file menu open, showing Create new file and Upload files.

Upload your materials into the repository once it exists.

Give some thought to the layout. The Data 8 materials keep hw, lab, lectures, and project at the top level, with each assignment in its own folder next to the data files it needs.

The materials-fds-v2 repository on GitHub, marked Public, with hw, lab, lectures, and project folders listed at the top level.

ucb-dsus-adopters/materials-fds-v2 as an example of a layout that stays predictable across a term.

A consistent layout pays off later, because it makes your links regular enough to edit by hand.

We recommend the DataHub Link Generator Chrome extension. nbgitpuller also publishes a link generator form if you would rather not install anything.

Open the notebook you want students to land on, on GitHub, then click the extension from the puzzle icon in your browser toolbar. It reads the repository, branch, and file path from the page you are looking at.

A notebook open on GitHub with the extension popup beside it, showing a JupyterHub URL field, an Open in dropdown, and a Copy nbgitpuller link button.

The extension fills in the repository and file path from whichever page you have open.

Enter your hub address in JupyterHub URL. Hub URL covers where to find yours. Then choose what students should open in.

The extension panel with the Open in dropdown expanded, listing Classic Notebook, JupyterLab, Shiny, RStudio, and VSCode.

Five targets are available. Classic Notebook opens the notebook by itself, and JupyterLab opens it with the file browser alongside.

Choose Copy nbgitpuller link and share it however your course reaches students.

Landing students in a folder instead of a notebook

Generating the link from a notebook page sends students straight to that notebook. Sometimes you want them in a folder instead — a whole lab with its data files, say, where they pick the file themselves.

Open the folder on GitHub rather than a notebook, then use the extension the same way. It reads the path from whichever page you are on, so a folder page produces a folder link.

If you already have a notebook link, you can shorten it by hand. Delete the file name from the end of urlpath, leaving the folder:

...&urlpath=tree%2Fmaterials-fds-v2%2Fhw%2Fhw01%2Fhw01.ipynb    opens hw01.ipynb
...&urlpath=tree%2Fmaterials-fds-v2%2Fhw%2Fhw01                 opens the hw01 folder

What students see on arrival depends on the target you picked in Open in: JupyterLab shows the folder in the file browser, and Classic Notebook shows a directory listing.

A generated link looks like this:

https://datahub.berkeley.edu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fucb-dsus-adopters%2Fmaterials-fds-v2&branch=main&urlpath=tree%2Fmaterials-fds-v2%2Fhw%2Fhw01%2Fhw01.ipynb
PartWhat it does
https://datahub.berkeley.eduThe hub the student is sent to
/hub/user-redirect/git-pullPulls into whichever account is signed in
repo=The repository to copy, URL encoded
branch=mainThe branch to pull from
urlpath=The file to open once the copy finishes

The urlpath records where you were when you generated the link, so a link made from HW01 opens HW01. If your repository has a consistent layout, you can copy a link and change hw01 to hw02 rather than generating a new one.

What happens when a student clicks

The whole repository copies into the student’s space, and then the file named in urlpath opens. They get everything, not just the one notebook, which is why the data files an assignment needs should sit in the repository beside it.

Homework 1 open in the Classic Notebook interface, at a hub address under the signed-in user's own account showing the materials-fds-v2 repository path.

Where the link above lands. The repository now sits in the student’s own space, and HW01 is open in Classic Notebook, the target chosen when the link was made.

Send the same link again later and nbgitpuller merges rather than overwrites:

If a link does not behave the way you expect, getting help covers where to ask.

To skip the server options page as well, so students go from the link straight into a running server, see Autostart Links.