We recommend syncing content to and from JupyterHub using Git and GitHub. However, before you can start, we will need to tell Git and GitHub who we are.
Start a terminal session inside your hub using the terminal launcher (#18 in the Interface Overview)
In the terminal in JupyterHub, enter the following commands:
Set your git identity with your name and email
Set default configurations for git. These commands will set git to always clone using SSH and set the default branch name to main
rather than the traditionally used master
Generate an ssh key:
This creates a new ssh key, using the provided email as a label.
3. When you're prompted to "Enter a file in which to save the key," press Enter accept the default file location.
4. You will be asked for a passphrase. If you will be using nbgitpuller magic links in combination with git, please leave it empty, the passphrase prompt may break nbgitpuller. If you leave it empty, you won't be asked for the passphrase when connecting to GitHub. For more information, see "Working with SSH key passphrases".
Copy the SSH public key to your clipboard
The following command shows the public SSH key on the terminal.
Copy the entire key which starts with ssh-rsa
and ending with "your_email@example.com"
Go to https://github.com. In the upper-right corner of any page, click your profile photo, then click Settings.
In the "Access" section of the sidebar, click SSH and GPG keys.
Click New SSH key or Add SSH key.
In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
In the "Key type" field it should say Authentication Key
In the "Key" field, paste your public key
Click Add SSH key
In the terminal of your hub type
After accepting the host key you should received:
Congratulations! You've successfully authenticated Github in JupyterHub!