Git and https / SSL

Thu, May 3, 2012 The communication between git clients and the git server can be encrypted using the https protocol.

To use this feature, it is recommended to own a valid certificate issued from a certificate authority (verysign, thawte, etc.). A self signed certificate is provided by default, but we strongly advise you to use your own certificate. GitStack supports the most secure protocols : SSL v3 and TLS v1.

We will suppose during this tutorial that we would like to setup https for a company called “contoso” which owns the “contoso.com” certificate.

1. Install your certificate on gitstack


Open a windows explorer to C:\GitStack\data\certificates
Back up the provided self signed certificates.
Copy your own certificate file and rename it to server.crt
Copy your own private key file and rename it to server.key

Copy your ssl certificates

2. Configure gitstack to accept https connections


Launch GitStack in your web browser, open the Settings/Security tab.
Click on “Accept http and https” and click on save.

click on accept ssl

Note : If you click on “Accept https only”, do not forget to reload your administration panel with the https protocol instead of the http protocol.

3. Test the connection


Type in your command line :
git clone https://contoso.com/repo1.git

It might fail for the following reasons :
-If you are using the certificate provided by default, you will need to disable the certificate verification from your git client by typing :
git config   – –global http.sslVerify false

-If you are using your own certificate, make sure that you are using your domain in the address. git clone https://contoso.com/repo1.git
instead of
git clone https://192.168.0.1/repo1.git
Disable the certificate verification if you cannot use your domain name.