Install and set up the GitLab for VS Code extension

To use the GitLab for VS Code extension, install the extension, connect to GitLab, and then configure it as needed.

Install the extension

Choose the installation method that meets your needs:

Install in a Visual Studio Code Dev Container

For added security, set up the extension and use GitLab Duo in a containerized development environment using VS Code Dev Containers.

Prerequisites:

  • Docker is installed and running.
  • The Visual Studio Code Dev Containers extension is installed in VS Code.

To install the extension in a VS Code Dev Container:

  1. Run the Dev Containers: Add Dev Container Configuration Files command from the Command Palette.

  2. Add the GitLab extension to the configuration file:

    json
    // .devcontainer/devcontainer.json
    {
    "name": "My Project",
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
    "customizations": {
       "vscode": {
          "extensions": [
          "GitLab.gitlab-workflow"
          ]
       }
    }
    }
  3. Run the Dev Containers: Open Folder in Container command to open your project in a VS Code Dev Container. VS Code automatically installs the extension inside the container.

Connect to GitLab