Mount Git configuration

Mount your Git configuration into workspaces to set your Git identity and preferences.

The user.name and user.email fields are set automatically to the gitconfig content from a git provider that is connected to Che. This connection requires a Git-provider access token or a token generated via OAuth, and you must set the username and email on the provider’s user profile page.

Prerequisites
Procedure
  1. Create a ConfigMap with your Git configuration:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: workspace-userdata-gitconfig-configmap
      labels:
        controller.devfile.io/mount-to-devworkspace: 'true'
        controller.devfile.io/watch-configmap: 'true'
      annotations:
        controller.devfile.io/mount-as: subpath
        controller.devfile.io/mount-path: /home/user
    data:
      .gitconfig: |
        [user]
          name = Your Name
          email = your.email@example.com
        [core]
          editor = vim
        [pull]
          rebase = true
  2. Apply the ConfigMap to your namespace:

    $ kubectl apply -f gitconfig.yaml -n <your_namespace>
  3. Start or restart your workspace.

Verification
  1. Open a terminal in your workspace.

  2. Verify the Git configuration:

    $ git config --list