Importing code from GitHub
Deepnote allows you to import public and private repositories from GitHub, just as you would with your local computer.
If you want to include a private or public repository, you can add it to your Deepnote project. This allows you and all your project collaborators to sync files from GitHub without touching the terminal.
Remember that when it comes to collaboration, Deepnote provides many native solutions. For example, consider the following use cases for collaboration that don't require GitHub:
- Sharing notebooks with access controls
- Real-time and asynchronous notebook collaboration
- Native versioning of notebooks
However, Deepnote's GitHub integration makes the following workflows simple:
- Using a private Python module in Deepnote notebooks
- Augmenting local library/package development
- Importing
.ipynb
files from GitHub to Deepnote's native representation
Adding a repository
Deepnote connects to GitHub through a GitHub app.
First, Click "Add GitHub repositories" to install the Deepnote GitHub app on your organization's or personal GitHub account.
In GitHub, you can configure the GitHub App to have access to all your organization's repositories or specific ones. This process only needs to be completed once per GitHub account or organization. Please note that if you use multiple workspaces, you have to complete the process for every workspace.
In case you want to add repositories from another Github organization, open the repository dropdown and click on the "Add GitHub repositories" button.
Once the GitHub App is installed, you can select the repository you want to add to Deepnote. You can also specify a branch or commit that you want to use.
Troubleshooting
If you don't see your repositories in the list after finishing the authorization process in Github, your GitHub organization may already be connected to another workspace in Deepnote. To fix this:
- Trigger the authorization process again from the new workspace
- Click on "Configure" button for your organization in GitHub
- Add the relevant repository in "Repository access" section
- Click on Save. This will connect your GitHub organization to the new workspace.
Public repositories
To use code from a public repository as an integration, fork the repository to your GitHub organization and use that repository.
Alternatively, it is also possible to clone a public repository via a terminal.
Git workflow
There are multiple actions you can execute on the connected GitHub repository in the UI. To see them in action, you can view the video at the beginning on this page.
- Changing the current branch. Just click on the dropdown with list of the branches and select a branch!
- Pulling the current branch from the remote
- Commit & Push to the remote (this will trigger a modal that will allow you to specify the commit message)
- Re-Clone - this will clone the repository from scratch into the same directory. Watch out, you might loose your local changes!
After executing any git command, you'll notice that output from the underlying git command that was executed.
Authentication under the hood
We use short-lived access tokens to authenticate git
commands. To be able to use this approach, we access the repository via HTTPS protocol rather than SSH. The token is valid for 1 hour and only grants access to the repository linked to the given project. We use the Custom Git Credential Helper to pass the token to the git
commands.
Revoking access
If you no longer want Deepnote to access some or all of your repositories, you can either revoke access to some repositories or uninstall the Deepnote GitHub application completely in your organization's GitHub settings at https://github.com/organizations/<your-organization>/settings/installations
.
We also verify if the person who linked the GitHub repository to a Deepnote project still has access to the GitHub repository. This means that if somebody leaves your organization or no longer has access to the repository in question, they'll no longer be able to access it through Deepnote.