Creating a workspace by importing the source code of a project

This section describes how to create a new workspace to edit an existing codebase.


You can do it in two ways before starting a workspace:

To create a new workspace to edit an existing codebase, use one of the following three methods after you have started the workspace:

Select a sample from the Dashboard, then change the devfile to include your project

  • In the left navigation panel, go to Get Started.

  • Click the Custom Workspace tab if it’s not already selected.

  • In the Devfile section, select the devfile template that will be used to build and run projects.

    Select a devfile from the list
  • In the Devfile editor, update projects section:

    Update projects section of the devfile
    Example: add a project

    To add a project into the workspace, add or edit the following section:

      - name: che
          type: git
          location: ''
  • To open the workspace, click the Create & Open button.

Importing from the Dashboard into an existing workspace

  1. Import the project. There are at least two ways to import a project using the Dashboard.

    • From the Dashboard, select Workspaces, then select your workspace by clicking on its name. This will link you to the workspace’s Overview tab.

    • Or, use the gear icon. This will link to the Devfile tab where you can enter your own YAML configuration.

  2. Click the Projects tab.

  3. Click Add Project. You can then import project by a repository Git URL or from GitHub.

Add projects to workspace

You can add a project to a non-running workspace, but you must start the workspace to delete it.

Editing the commands after importing a project

After you have a project in your workspace, you can add commands to it. Adding commands to your projects allows you to run, debug, or launch your application in a browser.

To add commands to the project:

  1. Open the workspace configuration in the Dashboard, then select the Devfile tab.

    Add commands to workspace
  2. Open the workspace.

  3. To run a command, select Terminal > Run Task from the main menu.

    Run task
  4. To configure commands, select Terminal > Configure Tasks from the main menu.

    Configure tasks

Importing to a running workspace using the Git: Clone command

To import to a running workspace using the Git: Clone command:

  1. Start a workspace, then use the Git: Clone command from the command palette or the Welcome screen to import a project to a running workspace.

    Welcome screen
  2. Open the command palette using F1 or CTRL-SHIFT-P, or from the link in the Welcome screen.

    Invoke git clone command
  3. Enter the path to the project you want to clone.

    Configure git clone command

Importing to a running workspace with git clone in a terminal

In addition to the approaches above, you can also start a workspace, open a Terminal, and type git clone to pull code.

Run git clone in a terminal

Importing or deleting workspace projects in the terminal does not update the workspace configuration, and the change is not reflected in the Project and Devfile tabs in the dashboard.

Similarly, if you add a project using the Dashboard, then delete it with rm -fr myproject, it may still appear in the Projects or Devfile tab.