Search code examples
windowsgitcurlgit-submodulesrunner

SSL error when with git submodules on windows runner


When running a job with gitlab runner under Windows with selfhosted gitlab, I got the error:

fatal: unable to access 'https://gitlab/repo.git/': SSL peer certificate or SSH remote key was not OK

How can this be fixed?


Solution

  • This error happens, when the git tries to download a submodule with curl and it cannot find the root certificate in its cert store. To find the location where curl searches for certificates, add

      variables:
        GIT_CURL_VERBOSE: "1"
    

    to the job which fails into the gitlab-ci.yml.

    You'll see output like:

    09:06:48.181569 http.c:938              == Info:  CAfile: C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
    09:06:48.181569 http.c:938              == Info:  CApath: none
    

    In this case the certificate was added to C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt and the job runs now successfully.