gitsslconfiguration

How can I tell git to ignore SSL errors only for one specific remote host?


I work in a computing environment where, for reasons beyond my control, attempting to access our git server from our compute cluster results in SSL errors (internal info redacted from ):

$ git ls-remote https://INTERNAL_URL_OF_GIT_REPO
fatal: unable to access 'https://INTERNAL_URL_OF_GIT_REPO': SSL certificate problem: unable to get local issuer certificate

However, both servers are behind our company firewall, so I know that the server is ok even if the certificate fails. I know that I can maually disable SSL verification with a command-line argument:

$ git -c http.sslVerify=false ls-remote https://INTERNAL_URL_OF_GIT_REPO
241a414084eb282617dfdd4862ba9d6e51b9916e    HEAD
241a414084eb282617dfdd4862ba9d6e51b9916e    refs/heads/main

And I further know that I could permanently set this option as default by doing git config --global http.sslVerify false. But I very much don't want to do this since it would globally disable all SSL verification. Even setting this option for the repo is too much. What I really want is to disable SSL verification just for a single remote URL. Is there any way to configure this?


Solution

  • Any of the http.* options can be applied selectively to some URLs. See the docs. Do

    git config --global http.https://INTERNAL_URL_OF_GIT_REPO.sslVerify false