【问题标题】:Unable to install .pfx certificate on jenkins无法在 jenkins 上安装 .pfx 证书
【发布时间】:2021-01-26 13:56:54
【问题描述】:

我必须从专用网络上的 git repo 结帐。我在我的系统上安装了所需的 pfx 证书,并且在提示符中提供密码后,当我连接到 VPN 时,我可以使用命令行获取/克隆 repo。但是,我不能在 Jenkins 上这样做。我尝试在 Jenkins 凭据管理器中安装 pfx,但文件甚至没有上传。 Jenkins 不再提供 vpn 插件支持。有没有办法做到这一点?

ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --force --progress -- ssh://root@10.247.186.70/srv/git/leaveRepo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: ssh: connect to host 10.247.186.70 port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

【问题讨论】:

  • 您是否尝试过为运行 Jenkins 服务的用户 ID 提供对 cert 目录的读取权限?
  • @Mike - 是的,我有。

标签: jenkins vpn keytool pfx pkcs#12


【解决方案1】:

来自文档:

  • 如果使用 ssh 协议访问远程 git 存储库,则凭据必须是私钥凭据。
  • 如果使用 http 或 https 协议访问远程 git 存储库,则凭据必须是用户名/密码凭据。

因此,您应该从 pfx 包中导出一个私钥,并使用 SSH username with private key 类型的凭据将其添加到 Jenkins。

【讨论】:

  • 带有私钥的 SSH 用户名给了我以下错误:错误获取远程 repo 'origin' hudson.plugins.git.GitException: Failed to fetch from ssh://rCaused by: hudson.plugins.git .GitException:命令“git.exe fetch --tags --force --progress --ssh://user@host:/abc.git +refs/heads/*:refs/remotes/origin/*”返回状态码128:标准输出:标准错误:root@:权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic、密码)。致命:无法从远程存储库中读取。请确保您具有正确的访问权限并且存储库存在。我可以访问 repo thrubash
  • 您检查私钥是否正常工作?为什么要用ssh://user@host:/abc.git这样的格式?你能试试git@github.com:group/project.git吗?
  • 那是因为我们没有使用 github 服务。只需 git bash 进行版本控制。存储库存储在专用网络上。由于安全策略原因,专用网络没有互联网连接。我在我的系统上安装了这个证书,并且可以在提示中输入密码后使用 git bash 终端从 vpn 克隆 repo。但是,当我在 jenkins 的凭证管理器上存储相同的私钥并将此密码作为密码时,我在 git fetch 上收到错误状态代码 128 权限被拒绝。
  • 好吧,从原始图像中我看到您正在使用 Jenkins 插件,它可能与您的情况不兼容。尝试配置ssh-agent 服务。你可以从dev.to/solrevdev/windows-does-not-remember-git-password-lmhdocs.github.com/en/free-pro-team@latest/github/…开始
猜你喜欢
  • 1970-01-01
  • 2018-04-19
  • 2015-05-08
  • 2011-04-22
  • 2018-10-21
  • 2020-08-06
  • 1970-01-01
  • 1970-01-01
  • 2013-06-07
相关资源
最近更新 更多