Add a Git repository to a Workspace
Categories:
Introduction
When researchers collaborate on the same Verily Workbench workspace, they may have one or more Git repositories where the shared notebook or scripts live. When researchers work from their local machine or Vertex AI notebook, a common workflow is that they clone the upstream git repositories, create a new branch, make some changes, push to the git repository for peer review, and then merge to the main branch.
You can add your Git repositories to a workspace to support a similar flow. Any Git repositories added to a given workspace before a cloud environment’s creation will automatically be cloned to that cloud environment. You can then use the git CLI or JupyterLab git extension to commit and push changes.
Setup
You can add a git repository via either the Workbench CLI or UI. First install the Workbench CLI or log in to workbench.verily.com
If you have not done so already, follow the instructions to auth and create a workspace. With the Workbench CLI, you can run:
terra auth login
terra workspace create
See “Getting started with the Workbench Web UI” to create a workspace via workbench.verily.com.
Add git repo references
Resources comprise a variety of entities whose chief purpose is to facilitate analysis. In many cases resources are simply multimodal data that can be managed within the workspace, but they aren’t limited to data exclusively. Inside a workspace, the “Resources” tab is where the data resources associated with that project are found.
Referenced resources, or simply references, represent data and other elements in Verily Workbench by pointing to a source that exists outside of the current workspace. While references are functionally identical to their source, they afford more flexibility and less risk, as anything done to a reference has no effect on its source.
Here is an example of creating two git-repo
references:
terra resource add-ref git-repo --name="wsm" --repo-url=https://github.com/DataBiosphere/terra-workspace-manager.git
terra resource add-ref git-repo --name="example_notebook" --repo-url=https://github.com/DataBiosphere/terra-example-notebooks.git
In the Workbench UI, it looks like this:

For a private repository, use the SSH URL instead of the HTTPS URL:

Set up a Workbench SSH key
In order for Workbench to clone your private GitHub repository, you need to first grant the Workbench SSH key access to your GitHub account. See “Setting up your Workbench SSH key” for more detail. (You can clone public repos without setting up the key.)
You can get your key information via either the Workbench CLI or the Workbench web UI.
Workbench CLI
Using the Workbench CLI, run:
terra user ssh-key get
Web UI
-
Navigate to the user profile:
-
Copy the SSH public key:
Add the Workbench SSH key to your GitHub account
Once you’ve created an SSH key, copy the public SSH key string, and then follow the GitHub instructions. We recommend that you name the key as something like “Workbench SSH key” to distinguish it from your personal SSH keys.
Create a Vertex AI notebook and clone the git repo referenced resources that the user has access to
- Create a cloud environment:
terra resource create gcp-notebook --name="my-cloud-env"
- Get the cloud environment proxy url from the output of running the command below:
terra resource describe –name="my-cloud-env"
-
See the git repo cloned in the instance:
Cloning a repo to an already-created notebook
If later on, more git-repo
resources are added to the workspace, and you want to clone them into a
jupyter notebook that you have already created (e.g. “my-cloud-env”), run:
terra git clone --all
Last Modified: 16 November 2023