Mounting Git configuration

The and fields will be set automatically to the gitconfig content from a git provider, connected to Che by a Git-provider access token or a token generated via OAuth, if username and email are set on the provider’s user profile page.

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: <gitconfig content> (2)
    1 A user namespace. Visit https://<che_fqdn>/api/kubernetes/namespace to get your Che user namespace as name.
    2 The content of your gitconfig file content.
  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.