【问题标题】:Switching git global config between gitlab and github在 gitlab 和 github 之间切换 git 全局配置
【发布时间】:2018-09-23 13:18:42
【问题描述】:

在我工作的地方,我们有一个托管的 gitlab,它需要一个客户端 ssl 证书才能允许连接。这已经在 git global config 中进行了配置,所以我的 ~/.gitconfig 运行良好。客户端证书请求仅在反向代理级别。不过,我们仍然使用用户名/密码作为凭据。

[http]
   sslCert = /Users/xuser/gitlab_ssl/xxx.crt
   sslKey = /Users/xuser/gitlab_ssl/xxx.key

现在每次我需要从 github 克隆时,我都会得到could not load PEM client certificate, LibreSSL error error:02001002:system library:fopen:No such file or directory, (no key found, wrong pass phrase, or wrong file format?)

我尝试使用 -c git -c http.sslCert="" -c http.sslKey="" clone https://github.com/xxxxx 覆盖配置,但它不起作用。我尝试使用别名,但我没有看到任何在顶级配置上使用别名的东西,比如 git 中的 [http] 块。

有没有办法: 1 - 使用公司 gitlab 的“git clone bla bla” 2 - 不尝试加载客户端证书的“git Everythingelse clone bla bla”?

提前致谢。

【问题讨论】:

    标签: git ssl-certificate mutual-authentication


    【解决方案1】:

    更改您的配置

    [http]
    

    [http "https://gitlab.com"]
    

    这将使这些配置设置仅适用于指向 GitLab 的 URL。 GitHub 等其他 URL 将不受此块中的配置更改的影响。如果您通过不同的 URL 访问托管的 GitLab,只需将该 URL 放入配置中。

    【讨论】:

      猜你喜欢
      • 2021-10-25
      • 2022-08-15
      • 1970-01-01
      • 2017-05-07
      • 2020-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多