nbgitpuller

How to use nbgitpuller to distribute contents in git repositories

What Is nbgitpuller?

nbgitpuller lets you share and distribute contents in git repositories, e.g. Jupyter Notebooks, with students via generating links without having to upload or download files themselves and without the need to understand git or other version control systems.

When you click the link:

  • It logs you into JupyterHub

  • Pulls notebooks from a Git repository to the home directory

  • Optionally opens a specific notebook directly after the repository is pulled

  • You can start working immediately

  • You don’t need Git knowledge

⚠️ Important: Collecting content from your users requires an alternative method, as nbgitpuller does not “push” and only “pulls”. So if the users want to push to a git repository, they have to directly use git. Avoid mixing git with automatic npbitpuller since it can cause problems.

see the documentation for more information.

Option A – Use the Link Generator Tool

  1. Go to: nbgitpuller link generator (or direct generator link from docs)

  2. Fill in:

  • JupyterHub base URL (e.g. https://jupyterhub.uni-muenster.de)

  • Git repository URL: e.g. https://github.com/jakevdp/PythonDataScienceHandbook (remember to remove .git from the URL so that the created folder does not have it as a part of the folder name)

  • Branch (e.g. main or master)

  • File to open (optional – path to .ipynb) : e.g. notebooks/01.00-IPython-Beyond-Normal-Python.ipynb

  1. Click Generate Link

  2. Paste it into Learnweb / Moodle / email / etc.

⚠️ Important: Please note that you have to change tree to lab/tree in the urlpath of the generated link, so that the notebook will be opened in your jupyterlab session and not just in the classic Jupyter notebook interface.

Option B – Build a Link Manually Format:

https://<JupyterHub-URL>/hub/user-redirect/git-pull?
repo=<GitRepoURL>&
branch=<branch-name>&
urlpath=<interface>/<repo-folder>/<notebook>

<interface>: /lab/tree

Example:

https://jupyterhub.uni-muenster.de/hub/user-redirect/git-pull?
repo=https://github.com/jakevdp/PythonDataScienceHandbook&
branch=master&
urlpath=lab/tree/notebooks/01.00-IPython-Beyond-Normal-Python.ipynb

This link opens the JupyterHub (login required), automatically downloads the latest version of the remote repository and redirects directly to the desired directory or notebook.

One does not have to download or upload anything manually - you click on a link (e.g. from the Learnweb) and are immediately ready to work in the JupyterHub.