Mounting Git configuration

Follow the instructions below to mount a Git config file in a workspace.

  • You have logged in to the cluster.

  1. Prepare a new Kubernetes ConfigMap.

    kind: ConfigMap
    apiVersion: v1
      name: workspace-userdata-gitconfig-configmap
      namespace: <user_namespace> (1)
      labels: 'true' 'true'
      annotations: subpath /etc/
      gitconfig: "[user] \n  name = <git_user_name> \n  email = <git_user_email>" (2)
    1 A user namespace. Visit https://<che_fqdn>/api/kubernetes/namespace to get your Che user namespace as name.
    2 Your Git user name and email.
  2. Apply the ConfigMap.

    $ kubectl apply -f - <<EOF
  1. Start a new workspace by using the URL of a remote Git repository that the Git provider hosts.

  2. Once the workspace is started, open a new terminal in the tools container and run git config --get-regexp user.*. Your Git user name and email should appear in the output.