Connect to GitHub
Workspaces integrates with Git and GitHub for version control to match and enhance your development workflow. 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 workspace, you need to authenticate using either HTTPS or SSH.
Connecting over HTTPS (recommended)
From a terminal in the workspace, 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.
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:
-
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.
-
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.
-
Add SSH key
Select New SSH key, give it a descriptive title. Then select Authentication Key in the dropdown. Paste in your key.
-
Clone a repository over SSH
From a terminal in the workspace, run the following to clone a remote repository:
git clone git@github.com:user/repo.git # Replace with the repo SSH URL.
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.
For more information on security options and troubleshooting, see the GitHub SSH guides.