Cloning Source Code

The repos block of our recipe specification is used to clone code. This will use the permissions of the GitHub application you have connected with DevZero.

To clone one or multiple repos:

Advanced Methods of Code Cloning

This usually applies to cases where you need to use secrets to clone code. To learn more about how to save and use secrets:

You can use a command block to clone code directly:

    - command: |-
        git clone
      directory: /home/devzero
      name: clone public repo

    - command: |-
        # MY_PERSONAL_TOKEN is the key for a secret/environment variable saved at
        git clone https://$
      directory: /home/devzero
      name: clone private repo using PAT
     - command: |-
        # MY_PRIVATE_KEY is the key for secret/environment variable saved at
        # The value for that should be the private key part of what you saved as a deploy key:
        mkdir -p .ssh
        echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> .ssh/devzero_id25519
        echo $MY_PRIVATE_KEY >> .ssh/devzero_id25519
        echo "-----END OPENSSH PRIVATE KEY-----" >> .ssh/devzero_id25519
        chmod 400 .ssh/devzero_id25519

        GIT_SSH_COMMAND='ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new -i /home/devzero/.ssh/devzero_id25519' git clone
      directory: /home/devzero
      name: clone private repo over ssh using a deploy key

Some of the use cases where this is applicable:

  • You're not using GitHub for source control

  • You cannot authorize the GitHub app due to access control issues

  • You need to use deploy keys, personal access tokens, etc.

  • You need to use some other authentication methods than the DevZero default

  • You want to clone your repo to a custom directory

  • If there's something else you don't see supported, please drop us a note at

Accessing Code From Bitbucket

Step 1. Go to your repo page on the Bitbucket website

Step 2. Go to the Access Keys section

Step 3(a). Generate keys

ssh-keygen -t ed25519 -C "" -f devzero_id25519 -P '' -q

Step 3(b). Add the public key to your Bitbucket repo's access keys

First, copy the public key

cat ~/.ssh/ | pbcopy

Then, paste it in the Key section in the pop-up box.

Step 3(c). Add the private key to DevZero

Check the private key

Copy it

cat ~/.ssh/devzero_id25519 | pbcopy

Then paste it into your team's secrets section at

Call it BITBUCKET_PVT_KEY (or whatever you please, but this is referenced in Step 4)

Step 4. Build a recipe

Create a recipe and add a block that looks like the one below (check line 5 to ensure naming).

    - command: |-
        mkdir -p .ssh
        printf "%s" "$BITBUCKET_PVT_KEY" >> .ssh/devzero_id25519
        sed -i 's/^"//; s/"$//' .ssh/devzero_id25519
        chmod 400 .ssh/devzero_id25519
        GIT_SSH_COMMAND='ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new -i /home/devzero/.ssh/devzero_id25519' git clone
      dir: .
      name: clone_from_bitbucket

Step 5. Launch a workspace from that recipe

Visit your recipes pages here, and launch a workspace from that new recipe!

Last updated