Clone

This document shows how to clone a Git repository hosted on Buddy to your local development environment.

Cloning

Using HTTPS

From January 14, 2022, users with 2FA enabled won't be able to use their username/password to authorize Git operations over HTTPS. We recommend using personal API token authentication instead.

Interacting with your repository over HTTPS works even if you're behind a firewall or using a proxy. Certain interactions, such as pulling or pushing, require you to provide your Buddy email and password.

  1. Go to Code and click the Clone button.
  2. Switch the tab to HTTPS and copy the link:

HTTPS link for cloningHTTPS link for cloning

  1. Open the terminal and run this command to clone the repository:
git clone {BUDDY_GIT_REPO_LINK}
$
  1. Enter your username (Buddy email address) and password to authorize the operation.

Using SSH

SSH is a secure protocol that allows trusted computers to communicate without involving passwords – a popular method with improved security over HTTPS.

To clone your repository over SSH, you must add your public SSH key to Buddy. You can manage your SSH keys in your account's SSH key settings.

  1. Go to Code and click the Clone button.
  2. Switch the tab to SSH and copy the link:

SSH link for cloningSSH link for cloning

  1. Open the terminal and run this command to clone the repository:
git clone {BUDDY_GIT_REPO_LINK}
$

Authentication with personal API tokens

You can use personal API token authentication in Buddy-hosted repositories to clone and push to your repository from the application level using the Buddy API.

Authenticating with a token also significantly increases security, as you no longer need to send credentials in your requests.

Generating a token

  1. Go to My ID settings and switch to APIPersonal Access Tokens:
  2. Specify the name of the token and select the scopes:

    • To provide read-only access, which allows cloning and pulling, the token must have the Read repositories scope.
    • To allow pushing changes to the repo, the token must have the Write to repositories scope, which includes the read-only scope by default.
  3. Click Add a new API token and enter your password to create the token.
  4. Use the button to copy the token to clipboard and return to the token list:

Generated personal API access tokenGenerated personal API access token

You can't view the token after you close this window.

Cloning with a personal API token

You can clone your repository over HTTPS using a personal API token. When interacting with your repository, pass the token as the username - you don't need to provide a password.

For example, run this command to clone your Buddy-hosted repo:

git clone https://{TOKEN}@app.buddy.works/{WORKSPACE_URL_HANDLE}/{PROJECT_NAME}
$