Skip to content

Instantly share code, notes, and snippets.

@vishalzanzrukia
Last active March 31, 2016 07:27
Show Gist options
  • Save vishalzanzrukia/23e89faece71918f634b73c9d575088d to your computer and use it in GitHub Desktop.
Save vishalzanzrukia/23e89faece71918f634b73c9d575088d to your computer and use it in GitHub Desktop.
Add self sing certificate to Git and Maven

Maven

Maven is actually using JAVA_HOME environment variable configured into your system. So we need to tell to JVM that trust my certificate.

You can use following command to add certificate (.pem) file to your JDK (please make sure that you are using the same JDK for maven, you can check the JDK path used with maven using : mvn --version). I am giving below command as per my local machine paths, you can change accordingly.

keytool -importcert -file D:\me\info\Cyberoam_SSL_CA.pem -keystore "C:\Program Files\Java\jdk1.8.0_65\jre\lib\security\cacerts"

Please note that above solution will allow you to run mvn from command promt only. You might need to do some extra stuff if you are using maven plugin for eclipse or any other IDEs.

Git

Git is not connected with JDK, so we need to tell to Git externally to trust your certificate.

You can use following command to add certificate (.pem) file to your Git. I am giving below command as per my local machine paths, you can change accordingly.

git config --global http.sslCAInfo D:\me\info\Cyberoam_SSL_CA.pem

Please note that above solution will allow you to run git from command promt only. You might need to do some extra stuff if you are using git plugin for eclipse or any other IDEs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment