NBGitPuller
Sharing Notebooks (nbgitpuller)¶
With nbgitpuller, you can share Jupyter notebooks and other files from public Git repositories with others via a link. Anyone who opens the link can edit the files directly in their own JupyterLab workspace without having to manually download and upload them first. No Git knowledge is required.
Note: Changes made to notebooks shared via the link remain stored in the user’s personal workspace. They are not pushed back to the Git repository from which the notebooks originated. In an educational setting, nbgitpuller is therefore suitable for sharing course materials, but not for submitting edited notebooks.
Generate a Link¶
Option A – Use the Link Generator Tool
-
Open the: Link Generator
-
Enter the following in the link generator:
- JupyterHub URL: The address of your JupyterHub, e.g.,
https://uni-muenster.jupyterhub.nrw - Git repository URL: The address of the Git repository, e.g.,
https://github.com/jakevdp/PythonDataScienceHandbook. Note:.gitshould be removed from the end of the URL so that the extension does not become part of the folder name. - Branch: Name of the branch whose contents are to be deployed. You can find the branch name in the drop-down menu above the Git repository’s file list. In our example, it is
master:
The “master” branch of the PythonDataScienceHandbook repository is displayed. - File to open (optional): Path to a notebook that should be opened directly, e.g.,
notebooks/01.00-IPython-Beyond-Normal-Python.ipynb - Application to open: Select JupyterLab.
- JupyterHub URL: The address of your JupyterHub, e.g.,
-
Copy the automatically generated link above the input fields:
- Share the link, for example, via Learnweb, Moodle, or email.
⚠️ Important: Please note that you have to change
treetolab/treein theurlpathof the generated link, so that the notebook will be opened in a jupyterlab session and not just in the classic Jupyter notebook interface.
Option B – Build a Link Manually Alternatively, you can create the link manually. To do so, replace the placeholders in the following URL template:
https://<JupyterHub-URL>/hub/user-redirect/git-pull?
repo=<GitRepoURL>&
branch=<branch-name>&
urlpath=</lab/tree>/<repo-folder>/<notebook>
Here,
<JupyterHub-URL>refers to the address of your JupyterHub,<GitRepoURL>refers to the address of the Git repository,<branch-name>refers to the name of the branch,<repo-folder>refers to the folder into which the repository will be imported in JupyterHub,<notebook>refers to the path to the desired notebook within the repository, including any subfolders.
Example:
https://uni-muenster.jupyterhub.nrw/hub/user-redirect/git-pull?
repo=https://github.com/jakevdp/PythonDataScienceHandbook&
branch=master&
urlpath=lab/tree/notebooks/01.00-IPython-Beyond-Normal-Python.ipynb
For more information, see the documentation.
