Skip to main content

Git integration

As a developer, you're likely familiar with using Git and GitHub for version control in software development. Anyscale Workspaces integrates with Git not just to match your workflow, but to enhance it. This means you keep the familiar actions of pushing, pulling, branching, and committing code while being able to program a scalable cluster. All committed and uncommitted changes persist across Workspace restarts, with the exception of files specified in .gitignore.

In this way, you can rely on Workspaces for daily development. You have a consistent developer experience whether you scale down to a small CPU node akin to a laptop or power up to a multi-GPU cluster for high performance AI workloads.

Authenticating with GitHub

To connect to a GitHub repository from an Anyscale Workspace, you need to authenticate using either HTTPS or SSH.

From the command line in the Anyscale-hosted Visual Studio Code, JupyterLab, or the Web Terminal, run the following to clone a remote repository:

git clone https://github.com/user/repo.git # Replace with the repo HTTPS URL

In Visual Studio Code, follow the UI to sign in using GitHub. Otherwise, when prompted, enter your GitHub username and personal access token in place of a password.

tip

When you git clone, git fetch, git pull, or git push to a remote repository using HTTPS URLs on the command line, Git asks you for your GitHub username and password. See Git passwords documentation for credential management options.

Connecting over SSH

With SSH (Secure Shell Protocol) keys, you can connect to GitHub without entering your username and personal access token with each action. Anyscale generates a unique SSH key tied to your user account. Follow these instructions for adding a new SSH authentication to your account on GitHub.com:

  1. Copy the Anyscale SSH key to your clipboard

    To access the SSH key, start a Workspace, and run the following on the command line to show it:

    cat ~/.ssh/id_rsa.pub

    From here, copy the SSH key to your clipboard without adding any newlines or whitespace.

  2. Navigate to GitHub.com settings

    Sign in to your account, click your profile photo, then select Settings. In the "Access" section of the sidebar, click SSH and GPG keys.

  3. Add SSH key

    Select New SSH key, give it a descriptive title. Then select Authentication Key in the dropdown. Paste in your key.

  4. Clone a repository over SSH

    From the command line in the Anyscale-hosted Visual Studio Code, JupyterLab, or the Web Terminal, run the following to clone a remote repository:

    git clone git@github.com:user/repo.git # Replace with the repo SSH URL
warning

Anyscale SSH keys aren't stored securely in a key store, so it's possible for other users in the organization to access this key. Secure your SSH key with a passphrase for an extra layer of security. See the GitHub documentation on SSH key passphrases.

tip

For more information on security options and troubleshooting, see the GitHub SSH guides.