If your Git server is secured with two-way SSL and user name with password, you must add the certificate files to your source build and add references to the certificate files in the .gitconfig file.
-
Git credentials
Add the certificate files to your source build and add references to the certificate files in the .gitconfig file.
-
Add the client.crt, cacert.crt, and client.key files to the /var/run/secrets/openshift.io/source/ folder in the application source code.
-
In the .gitconfig file for the server, add the
[http]
section shown in the following example:# cat .gitconfig [user] name = <name> email = <email> [http] sslVerify = false sslCert = /var/run/secrets/openshift.io/source/client.crt sslKey = /var/run/secrets/openshift.io/source/client.key sslCaInfo = /var/run/secrets/openshift.io/source/cacert.crt
-
Create the secret:
$ oc create secret generic <secret_name> \ --from-literal=username=<user_name> \ (1) --from-literal=password=<password> \ (2) --from-file=.gitconfig=.gitconfig \ --from-file=client.crt=/var/run/secrets/openshift.io/source/client.crt \ --from-file=cacert.crt=/var/run/secrets/openshift.io/source/cacert.crt \ --from-file=client.key=/var/run/secrets/openshift.io/source/client.key
-
The user’s Git user name.
-
The password for this user.
-
Important
|
To avoid having to enter your password again, be sure to specify the S2I image in your builds. However, if you cannot clone the repository, you still must specify your user name and password to promote the build. |
-
/var/run/secrets/openshift.io/source/ folder in the application source code.