向 Jenkins( Windows) 添加 Git 仓库时总是报错,当添加 HTTPS 仓库地址时报错:
Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h -- >https://git.\***.com/gitlab/git.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://git.***.com/gitlab/git.git/': OpenSSL SSL_connect: >SSL_ERROR_SYSCALL in connection to git.***.com:443
当添加 SSH 仓库地址时报错:
Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h -- >git@git.***.com:gitlab/git.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

即便给 Git 配置了 SSL 证书,创建了秘钥,问题依旧。最后查出原因是安装 Jenkins 选择了使用 LocalSystem 账户运行服务,这导致 Git 不能使用本地用户所做的配置,所以秘钥和证书都不起作用。

解决方法是在服务管理器中将登录用户换为你的系统账户。

或者重新安装 Jenkins,选择你所使用的本地账户或域账户作为服务的启动账户。

注意,使用本地账户时输入框要输入 计算机名\账户名 。
|