Cloning Repositories into a Workspace

This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.

This guide can help you clone code from an external Git repository into a workspace. Because it requires the workspace terminal, only app owners can clone into the workspace.

The instructions below assume a GitHub repository, but steps are similar for other types of Git repositories.

You can clone from an external repository over SSH or HTTPS.

To clone code from a GitHub repository into a workspace over SSH:

  1. Open your workspace. In the terminal, verify that you are in the /home/workspaceuser/app directory:
    sh pwd
    The output should be
    sh /home/workspaceuser/app
    If it isn’t, cd to /home/workspaceuser/app.

  2. Delete all the files in the /home/workspaceuser/app directory, including the hidden files prefixed with .:

    sh rm -rf * rm .gitignore rm -rf .git

  3. Generate an SSH key pair for your workspace if it doesn’t have one already:
    sh ssh-keygen -t ed25519 -C "my-workspace-key"
    See Setting Up SSH Keys for more information on generating an SSH key pair.

  4. Add the public SSH key to your GitHub account.

  5. Clone your repository to the /home/workspaceuser/app directory:

    sh git clone <repository-url> .

    Replacing <repository-url> with the SSH URL of the repository.

    Heads up! Don’t forget the . (the period at the end of the command).
    If you omit the ., then your files are created in a new directory under /home/workspaceuser/app
    and the important application structure
    files like requirements.txt are not detected by the workspace.

    Your files should appear in the explorer panel on the left.

  6. Verify that the code was cloned to the correct location. In the /home/workspaceuser/app directory, run:
    sh ls

    The output should correspond to your application structure files
    like Procfile, requirements.txt (pip) or environment.yml (Conda), not another directory name.

We normally recommend using one-click deploy to deploy from a workspace, but due to an issue with one-click deploy after deleting the .git directory, we recommend using the Dash Enterprise CLI:

de deploy --name <app-name>

where <app-name> is the name of the app whose workspace you’re in.

Prerequisites:
* You have a personal access token with write permission to the repository you want to clone.

To clone code from a GitHub repository into a workspace over HTTPS:

  1. Open your workspace. In the terminal, verify that you are in the /home/workspaceuser/app directory:
    sh pwd
    The output should be
    sh /home/workspaceuser/app
    If it isn’t, cd to /home/workspaceuser/app.

  2. Delete all the files in the /home/workspaceuser/app directory, including the hidden files prefixed with .:

    sh rm -rf * rm .gitignore rm -rf .git

  3. Clone your repository to the /home/workspaceuser/app directory:

    sh git clone <repository-url> .

    Replacing <repository-url> with the HTTPS URL of the repository.

    Heads up! Don’t forget the . (the period at the end of the command).
    If you omit the ., then your files are created in a new directory under /home/workspaceuser/app
    and the important application structure
    files like requirements.txt are not detected by the workspace.

  4. When prompted, enter your GitHub username.

  5. When prompted for your GitHub password, enter your personal access token.

    Your files should appear in the explorer panel on the left.

  6. Verify that the code was cloned to the correct location. In the /home/workspaceuser/app directory, run:
    sh ls

    The output should correspond to your application structure files
    like Procfile, requirements.txt (pip) or environment.yml (Conda), not another directory name.

We normally recommend using one-click deploy to deploy from a workspace, but due to an issue with one-click deploy after deleting the .git directory, we recommend using the Dash Enterprise CLI:

de deploy --name <app-name>

where <app-name> is the name of the app whose workspace you’re in.