Mounting Git configuration
The |
Follow the instructions below to mount a Git config file in a workspace.
Prerequisites
-
You have logged in to the cluster.
Procedure
-
Prepare a new Kubernetes ConfigMap.
kind: ConfigMap apiVersion: v1 metadata: name: workspace-userdata-gitconfig-configmap namespace: <user_namespace> (1) 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: /etc/ data: gitconfig: <gitconfig content> (2)
1 A user namespace. Visit https://<che_fqdn>/api/kubernetes/namespace
to get your Che user namespace asname
.2 The content of your gitconfig file content. -
Apply the ConfigMap.
$ kubectl apply -f - <<EOF <ConfigMap_prepared_in_step_1> EOF
Verification
-
Start a new workspace by using the URL of a remote Git repository that the Git provider hosts.
-
Once the workspace is started, open a new terminal in the
tools
container and rungit config --get-regexp user.*
. Your Git user name and email should appear in the output.