I have just gone through the same process as yourself on Windows Server 2008 R2. I wanted a wildcard certificate to work with Gitblit and other services that I wanted to run.
First of all I created the CSR in IIS and installed the certificate into there. I had done this before and was wanting to use the certificate in IIS anyway so this made sense to use IIS for this part of the process. Follow your CA's instructions regarding intermediate certificates as well.
I then had a lot of trial and error to get the next stage to work but got it going by doing the following:
- Open MMC
- Add Snapin and choose Certificates for Local Computer
- Go to Personal, Certificates and select the relevant certificate.
- Open the Certificate and click on the Details tab, then click on Copy to File
- Click Next, then choose to export the private Key and click Next
- Make sure that "Include all certificates in the certification path if possible" is checked and that the other 2 boxes are not. Click on Next.
- Enter a password then click Next.
- Enter a File Name and click Next then Finish the creation of the file.
I then used Portecle to open the existing Keystore that was created by Gitblit using the password of gitblit (or whatever was set when you created the keystore). To import the certificate click on Tools, Import Key Pair and browse to the file created above. It will ask you to enter the password for the certificate, then to select a key pair to import and an alias for it.
Once that certificate is in the keystore you can remove the self signed certificate as it is not needed anymore.
I then restarted Gitblit and connected with the hostname matching the certificate and everything was good.
The main problem I was having resulted from not including the whole chain when exporting the certificate from IIS.
I hope this helps as it took me a couple of days to figure it out myself.