Save a notebook to GitHub

Vertex AI Workbench user-managed notebooks is deprecated . On April 14, 2025, support for user-managed notebooks will end and the ability to create user-managed notebooks instances will be removed. Existing instances will continue to function but patches, updates, and upgrades won't be available. To continue using Vertex AI Workbench, we recommend that you migrate your user-managed notebooks instances to Vertex AI Workbench instances .

To back up your user-managed notebooks instance and make it available to others, save the contents of your user-managed notebooks instance to GitHub.

Create a GitHub repository

If you don't already have a GitHub repository, you must create one.

When you create your GitHub repository make sure that your GitHub repository can be cloned by selecting the Initialize this repository with a READMEcheckbox.

Initialize a GitHub repository with a README file.

Clone your GitHub repository in your user-managed notebooks instance

To clone your GitHub repository in your user-managed notebooks instance, complete the following steps:

  1. In your GitHub repository, click the Codebutton, and then click the Localtab.

  2. Copy the HTTPSURL.

  3. In the Google Cloud console, go to the User-managed notebookspage.

    Go to User-managed notebooks

  4. Click Open JupyterLabto open your user-managed notebooks instance.

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

    Notebook home folder.

  6. In JupyterLab, select Git  > Clone a Repository.

  7. If prompted, enter your credentials.

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

    • If you use two-factor authentication with GitHub, create and use a personal access token .

  8. In the Clone a repodialog, paste the HTTPS URL for your GitHub repository.

    Paste repository URL and clone.

  9. Click Clone.

Configure your user-managed notebooks instance with your GitHub user information

  1. In JupyterLab, select Git  > Open Git Repository in Terminalto open a Git terminal window.

  2. In the Git terminal window, enter the following commands to configure your Git username and email:

    git config --global user.name " YOUR_NAME 
    "
    git config --global user.email " YOUR_EMAIL 
    "
  3. If your GitHub account requires SSH authentication, complete the following steps to connect your account:

    1. From your Git terminal in your user-managed notebooks instance, follow GitHub's instructions for generating a new SSH key .

    2. Follow the instructions for adding that SSH key to your GitHub account .

  4. Close the Git terminal window.

Add your committed files to your GitHub repository

  1. Your user-managed notebooks instance shows your repository as a new folder. If you don't see your cloned GitHub repository as a folder, click the Refresh File Listbutton.

    Refresh File List button.

  2. Double-click your repository folder to open it.

  3. Add a new notebook to your user-managed notebooks instance.

    To add a notebook file, you can use the menu or the Launcher.

    1. To add a new notebook file from the menu, select File  > New  > Notebook.

      Add a notebook file.

    2. In the Select kerneldialog, select the kernel for your new notebook, for example, Python 3, and then click Select.

      Your new notebook file opens.

    Launcher

    1. To add a new notebook file from the Launcher, select File  > New  > Launcher.

    2. Click the tile for the kernel you want to use.

      Add a notebook file.

      Your new notebook file opens.

  4. Rename your new notebook file.

    1. Select File  > Rename notebook. The Rename filedialog opens.

    2. In the New namefield, change Untitled.ipynb to something meaningful, such as install.ipynb .

    3. Click Rename.

    Launcher

    1. Right-click the Untitled.ipynb tab and then click Rename notebook. The Rename filedialog opens.

    2. In the New namefield, change Untitled.ipynb to something meaningful, such as install.ipynb .

    3. Click Rename.

  5. Select the Gittab. Your new notebook is listed in the Untrackedgrouping.

  6. To add the new notebook as a file for your GitHub repository, right-click the new notebook and select Track. On the Gittab, your notebook is now added to the Stagedgrouping.

  7. To commit your new notebook to your GitHub repository, on the Gittab, add a commit comment and click Commit.

  8. To open a Git terminal window, select Git  > Open Git repository in terminal.

  9. In the Git terminal window, enter the git push command.

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

    • If you use two-factor authentication with GitHub, create a personal access token to use.

    When the git push command completes, your committed files are in your GitHub repository.

Create a Mobile Website
View Site in Mobile | Classic
Share by: