Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
连接到GIT存储库时出错对等证书无效_Git_Github_Ssh_Ssl Certificate - Fatal编程技术网

连接到GIT存储库时出错对等证书无效

连接到GIT存储库时出错对等证书无效,git,github,ssh,ssl-certificate,Git,Github,Ssh,Ssl Certificate,我的公司已迁移到一个新的GITHUB存储库。在我的Linux开发服务器上,我试图连接到新的git存储库以克隆它。我有一个部署工具,可以从GIT存储库获取软件并自动部署 但是,我与新存储库的新连接不起作用 $ git clone https://githubxxxxx.com/xxxxxxx/myrepo.git Cloning into 'myrepo'... fatal: unable to access 'https://githubxxxxx.com/xxxxxxx/myrepo.git/

我的公司已迁移到一个新的GITHUB存储库。在我的Linux开发服务器上,我试图连接到新的git存储库以克隆它。我有一个部署工具,可以从GIT存储库获取软件并自动部署

但是,我与新存储库的新连接不起作用

$ git clone https://githubxxxxx.com/xxxxxxx/myrepo.git
Cloning into 'myrepo'...
fatal: unable to access 'https://githubxxxxx.com/xxxxxxx/myrepo.git/': Peer's certificate issuer has been marked as not trusted by the user.
我想我已经做了我想做的一切:

  • 我为SSH创建了一个新密钥
  • 我将密钥存储在GIT存储库中
我对我的笔记本电脑做了同样的程序,结果它成功了

如果我更改sslVerify的全局属性

git config --global http.sslVerify false
然后我可以连接和克隆,但每次我都必须输入用户和密码,这是没有意义的

有人知道我有没有走错一步吗?是否有其他全局变量需要设置

如果我对存储库执行
ssh-v
,我会发现我可以进行身份验证

debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ftpfdm/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to githubxxxxx.com (via proxy).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: proc
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi x329097! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to githubxxxxx.com closed.
新更新

相反,这是可行的。有人知道为什么它是这样工作的,而不是通过ssh://,而实际上是通过ssh进行克隆。我正要把这个解决方案作为答案发布,但我认为这是不对的,因为我不知道为什么这种方法会奏效

git clone git@githubxxxxx.com:group/myrepo.git
对等方的证书颁发者已被用户标记为不受信任

这纯粹是一个HTTPS问题,与SSH无关

您需要执行以下操作:

  • 将其另存为文件
    /home//ghe.pem
    (用用户登录名替换

  • 参考:

    git config --global http."https://githubxxxxx.com/".sslcainfo ${HOME}/ghe.pem
    

如果您使用的是SSH URL,则始终需要使用远程用户“
git
”,这就是为什么
git@githubxxxxx.com:group/myrepo.git
工作。

当您通过
https://
连接时,您没有通过SSH连接。将您的url切换到ssh:
ssh://git@…
@knittl,如果我这样做,我会被拒绝连接。我试过了
git@github…:group/project.git
(主机部分之后的
很重要)GitHub有选项为您生成这些URL我更新了问题。如果我尝试你的方法,我会发现新的错误。它没有
ssh://
。然而,我不知道为什么。
git config --global http."https://githubxxxxx.com/".sslcainfo ${HOME}/ghe.pem