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

Prerequisites

There are two ways to do that 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:

Importing from the Dashboard into an existing workspace

  1. Import the project. There are at least two ways to import a project via 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 a sample project, create a blank project, import from a Git project, or import from a zip file.

Add projects to workspace

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

Creating a new repository

To add a blank project:

  1. Type a name and a description in the Name and Description fields.

    Add blank project
  2. Click Open to open your workspace.

Your empty project

Editing an existing repository

To edit an existing repository:

  1. Choose the Git project or zip file, and Che will load it into your workspace.

    Add existing git project
  2. To open the workspace, click the Open button.

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 via the Dashboard, then delete it with rm -fr myproject, it may still appear in the Projects or Devfile tab.

Tags: