Git: http.sslVerify false global but only for specific remote

℡╲_俬逩灬. 提交于 2020-06-25 04:33:16

问题


I'm looking for a way, to disable the Git SSL verification globally but for a single remote only.

The only ways I know about, are these two possibilies:

  • Do it globally, for all remotes: git config --global http.sslVerify false
  • Do it locally in every single remotes repo: git config --local http.sslVerify false

But is there a chance to set the config like you can do it with proxy settings? For example:

I have a system wide set proxy config in my ~/.gitconfig. But instead of overriding it by a local proxy setting, I used:

git config --global remote.<remote name>.proxy "" (in this case for a direct connection)

Unfortunately something like the following does not work:

git config --global remote.<remote name>.http.sslVerify false

Any ideas? Thanks and regards!


回答1:


In the gitconfig you can specify for each remote address both proxy and sslVeryfy like this:

no proxy and sslVerify false

[http "https://blah.com/"]
    sslVerify = false
    proxy =

and also for all the others proxy and sslVerify false

[http]
    sslVerify = false
    proxy = http://yourproxyaddress.com:8080



回答2:


In case anyone else stumbles upon this, the way to set http.sslVerify for a specific remote from command line would be:

git config --global http.<remote name>.sslVerify false

e.g.

git config --global http.https://gitlab.domain.com/.sslVerify false


来源:https://stackoverflow.com/questions/38102285/git-http-sslverify-false-global-but-only-for-specific-remote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!