Set up GitHub in JupyterLab¶
For assistance integrating git within the Snowsight interface see the Snowflake User Guide
JupyterLab offers a git plugin to operate with your preferred repositories in your Platform environment. Based on your git server configuration, you can access your repositories using standard credentials (username and password) or an SSH connection.
How to use HTTPS¶
This document describes how to set up an integration using HTTPS.
If the repository is public, you can clone a repository from the Terminal by doing the following:
-
Open JupyterLab in Builder.
-
Open a Terminal session.
-
Run the command git clone
https_repo_url
.
Note: If the repository is public, you can also clone a repository from the git plug-in by copying the HTTPS repo URL.
If the repository is private, you can clone a repository from the Terminal by doing the following:
-
Open JupyterLab in Builder.
-
Open a Terminal session.
-
Run the command git clone
https_repo_url
. -
Insert your credentials when prompted.
-
Once you successfully clone a repository, it should be imported as a folder into the environment.
From there, you can view the differences and make commits, but not push changes on Github.
How to use SSH¶
These instructions cover how to create and set up an SSH key in order to push and pull your repositories:
- Open JupyterLab in Builder.
- Open a Terminal session.
-
Create a pair of SSH keys by typing the following command:
ssh-keygen -t rsa -b 4096 -C “email\_address”
-
Save your key in the default folder by hitting enter on the first prompt.
- Enter a passphrase (optional) or leave it blank and hit enter.
- Navigate to the .ssh folder by typing cd .ssh
-
From within the .ssh folder enter the following command:
cat id\_rsa.pub
-
Copy the contents of the result starting from ssh-rsa... to your email, inclusive of both. Save this somewhere, as you’ll need to use it in the GitHub SSH key creation step below.
- In your browser, open GitHub, log in with the account you wish to connect, and navigate to your GitHub Settings page.
- Click on SSH and GPG Keys, then click the New SSH key button.
- Set a key name (i.e., spectusjupyterkey), paste your key (the results of the last command you ran in the Terminal) and click Add SSH Key.
- Authorize the key to access the Spectus repositories by pressing the Enable SSO button.
How to Clone a Repository¶
That’s all folks! Get back to the platform and clone your favourite repository.
-
Once connected, you can clone a repo by running the appropriate git command in a terminal session.
- For HTTPS, use the following command: git clone
https_repo_url
- For SSH, use the following command: git clone
ssh_repo_url
- For HTTPS, use the following command: git clone
-
Once you successfully clone a repository, it should be imported as a folder into the environment. From there, you can view the differences, and make commits, but not push changes on Github.