NBGitPuller
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
gitrepository, they have to directly usegit. Avoid mixinggitwith automatic npbitpuller since it can cause problems.
see the documentation for more information.
How to Generate a Link (Step-by-Step)¶
Option A – Use the Link Generator Tool 1. Go to: nbgitpuller link generator (or direct generator link from docs)
-
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.gitfrom 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 -
Click Generate Link
-
Paste it into Learnweb / Moodle / email / etc.
⚠️ Important: Please note that you have to change
treetolab/treein theurlpathof 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
What Happens When Users Click the Link¶
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.