Save a notebook to GitHub

This page describes how you can save your Vertex AI Workbench instance'snotebook files to GitHub by using thejupyterlab-git extension. You mightdo this to create a backup of the notebook or to make the notebookavailable to others.

In Vertex AI Workbench instances, you can use thejupyterlab-gitextension to help you with version control. To learn more, seejupyterlab-giton GitHub.

Create a GitHub repository

If you don't already haveaGitHub repository,you must create one.

When you create your GitHub repository make sure that your GitHub repositorycan be cloned by selecting theInitialize this repository with a READMEcheckbox.

Initialize a GitHub repository with a README file.

Clone your GitHub repository in your Vertex AI Workbench instance

To clone your GitHub repository in your Vertex AI Workbench instance,complete the following steps:

  1. In your GitHub repository, click theCode button,and then click theLocal tab.

  2. Copy theHTTPS URL.

  3. In the Google Cloud console, go to theInstances page.

    Go to Instances

  4. ClickOpen JupyterLab to openyour Vertex AI Workbench instance.

  5. In the JupyterLab File Browser, selectthe folder where you want to clone the GitHub repository. For example,the home folder.

    The JupyterLab file browser in Vertex AI Workbench, highlighting the home folder where a GitHub repository can be cloned.

  6. In JupyterLab, selectGit > Clone a Repository.

  7. In theClone a repo dialog, paste the HTTPS URL foryour GitHub repository.

    Dialog showing the field for the repository URL and options for submodules and download repository.

  8. If prompted, enter your credentials.

    • If you use a GitHub username and password, enter yourGitHub username and password.

    • If you use two-factor authentication with GitHub,create and use apersonal accesstoken.

  9. ClickClone.

  10. Your Vertex AI Workbench instance shows your repositoryas a new folder. If you don't see your cloned GitHub repositoryas a folder, click theRefresh File List button.

    The JupyterLab file browser in Vertex AI Workbench, with the Refresh File List button highlighted.

Configure your instance with your GitHub user information

  1. In JupyterLab, open the folder where your repository is located.

  2. SelectGit > Open Git Repository in Terminalto open a Git terminal window.

  3. In the Git terminal window, enter the following commands to configureyour Git username and email:

    git config --global user.name "USERNAME"git config --global user.email "EMAIL_ADDRESS"

    Replace the following:

    • USERNAME: your GitHub username
    • EMAIL_ADDRESS: your GitHub account email address
  4. If your GitHub account requires SSH authentication, completethe following steps to connect your account:

    1. From your Git terminal in your Vertex AI Workbenchinstance, follow GitHub'sinstructions for generating a newSSH key.

    2. Follow theinstructions for adding that SSH key to your GitHubaccount.

  5. Close the Git terminal window.

Add your committed files to your GitHub repository

  1. In JupyterLab, open the folder where your repository is located.

  2. Add a new notebook.

  3. Select theGit tab. Your new notebook is listed in theUntrackedgrouping.

  4. To add the new notebook as a file for your GitHub repository, right-clickthe new notebook and selectTrack. On theGit tab, your notebookis now added to theStaged grouping.

  5. To commit your new notebook to your GitHub repository, on theGit tab,in theSummary field, add a commit comment, and then clickCommit.

  6. SelectGit > Push to Remote.

    • If you use a GitHub username and password, when prompted, enter yourGitHub username and password.

    • If you use two-factor authentication with GitHub, enter yourGitHub username and personal access token.

    After thegit push command completes, your committed files are inyour GitHub repository.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.