Notebooks

Working with Git

Clone, pull, and push a repository from a notebook session.

Git works normally in Notebooks: your home is real disk and your identity is already set up. Your home is not backed up, so push often.

Clone and push a repository

Create an access token

Git over HTTPS needs a token, not your password.

  • GitHub: create a fine-grained personal access token with Contents: Read and write on the repositories you need, and copy it once. See GitHub’s guide.
  • Bitbucket: create a repository access token. Bitbucket shows a ready-made clone link that includes the token; you can use that link directly.

Treat the token as a password: never commit it or paste it into a notebook.

Clone the repository

Use the Git panel in the JupyterLab sidebar (Clone a Repository) and enter the HTTPS URL, or a terminal:

Clone over HTTPS
git clone https://github.com/<org>/<repo>.git

Use the HTTPS URL (ending in .git), not the SSH one (git@...). For the panel, see the jupyterlab-git documentation.

Authenticate once

When git asks for credentials, enter your username at the Git provider and paste the token as the password. Git caches it in ~/.git-credentials in your private home, so later sessions do not ask again.

Commit and push

Your name and email are pre-filled from your Databaas login, so commits are attributed to you with no git config step. New repositories start on main.

Commit and push
git add -A
git commit -m "Explore the transactions table"
git push

Reset a token that expired or was rotated

Authentication failures are usually an expired token, or a token without access to that repository. Remove the cached credential and authenticate again on your next git command:

Clear the cached token
rm ~/.git-credentials

This removes every cached Git credential, not only the one that failed.

Push often

Your home is not backed up, so an unpushed commit is the only copy. See notebook storage.