简体   繁体   English

Windows 上的 Git [权限被拒绝(公钥)] 的 Jenkins 问题

[英]Jenkins issue with Git [Permission denied (publickey).] on Windows

I know that thousands of topics touch my problem but I am fighting this from several days with almost zero progress ;(.我知道数以千计的主题会触及我的问题,但我在几天内一直在与这个问题作斗争,进展几乎为零;(。

I installed Jenkins on Windows machine.我在 Windows 机器上安装了 Jenkins。
Then acquired Git plugin and the Git itself.然后获得了 Git 插件和 Git 本身。
Everything is latest version for the day of my writing.一切都是我写作当天的最新版本。
I was just happy to start to play with Jenkins but I failed at configuring my Bitbucket repository to be used by Job.我很高兴开始与 Jenkins 一起玩,但我未能配置我的 Bitbucket 存储库以供 Job 使用。

I set the exact path to git.exe (as it seemed the reason for initial problems) [C:\\Program Files\\Git\\cmd\\git.exe].我设置了 git.exe 的确切路径(因为它似乎是初始问题的原因)[C:\\Program Files\\Git\\cmd\\git.exe]。

Then I tried accessing the repository by HTTPS with account credentials, many strange errors here so I thought let's try with SSH.然后我尝试使用帐户凭据通过 HTTPS 访问存储库,这里有很多奇怪的错误,所以我想让我们尝试使用 SSH。

I have generated rsa keys, set the public key in the Bitbucket repository.我已经生成了 rsa 密钥,在 Bitbucket 存储库中设置了公钥。 Then I created credential configuration in Jenkins for SSH authentication with passphrase.然后我在 Jenkins 中创建了凭证配置以使用密码进行 SSH 身份验证。
I have many problems here so for temporary workaround I explicitly set the value of private key.我在这里有很多问题,因此为了临时解决方法,我明确设置了私钥的值。
Finaly I got to the place where I am now:最后我到达了我现在所在的地方:

+refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

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

When I try to manualy copy repository, it politely asks me about passphrase and the copy is done.当我尝试手动复制存储库时,它礼貌地询问我密码短语并完成复制。 When Jenkins job does it the above happens.当詹金斯的工作做到这一点时,就会发生上述情况。 With help of %USERNAME% and %USERDOMAIN% in the Job's script I get the same values like when I do it manually.在作业脚本中的 %USERNAME% 和 %USERDOMAIN% 的帮助下,我获得了与手动执行时相同的值。

After plenty of hours I can say I can't use Git in Jenkins ;(很多小时后,我可以说我不能在 Jenkins 中使用 Git ;(

UPDATE更新

I don't believe that it could be so simple.我不相信事情会这么简单。 As mainframer mentioned, I left passphrase empty for the whole SSH authentication and it really worked (the repository is cloned even that Jenkins still shows the same error in job's configuration page).正如大型机提到的,我将整个 SSH 身份验证的密码留空,它确实有效(即使 Jenkins 在作业的配置页面中仍然显示相同的错误,存储库也被克隆)。 I only wonder about any consequences of such setup, but working thing is more valuable for me now.我只是想知道这种设置的任何后果,但现在工作对我来说更有价值。

You mean leaving empty passphrase while generating keys and then also no passphrase config in Jenkins ssh credentials?您的意思是在生成密钥时留下空密码,然后在 Jenkins ssh 凭证中也没有密码配置?

Yes, as Jenkins wouldn't be able to feed the passphrase to the ssh session.是的,因为 Jenkins 无法将密码提供给 ssh 会话。

But make sure the Jenkins slave service runs with your account (and not with the system account).但请确保 Jenkins slave 服务使用您的帐户(而不是系统帐户)运行。 It needs your account to find the ssh keys in %USERPROFILE%\\.ssh\\id_rsa(.pub)它需要您的帐户才能在%USERPROFILE%\\.ssh\\id_rsa(.pub)找到 ssh 密钥

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Jenkins配置为在Windows上使用GIT,得到stderr:权限被拒绝(公钥) - Configure Jenkins to use GIT On Windows, Got stderr: Permission denied (publickey) 为什么 git@github.com:Windows 中的权限被拒绝(公钥)? - Why git@github.com: Permission denied (publickey) in windows? 设置 Jenkins 时权限被拒绝(公钥) - Permission denied (publickey) when setting up Jenkins IntelliJ IDEA git 权限被拒绝(公钥) - IntelliJ IDEA git Permission denied (publickey) 权限被拒绝(公钥)-用Git不能推入或拉出 - Permission denied (publickey) - Cant push or pull with Git 使用与 Windows 主机共享的存储库在“git fetch”上的 Ubuntu VM 上突然出现“权限被拒绝(公钥)” - Suddenly getting “Permission denied (publickey)” on Ubuntu VM on “git fetch” using repository shared with Windows host 使用Moovweb时Windows上的权限被拒绝(publickey)错误 - Permission denied (publickey) errors on Windows when using Moovweb Git 子模块:git@github.com:权限被拒绝(公钥)。 致命:无法从远程存储库中读取 - Git submodule: git@github.com: Permission denied (publickey). fatal: Could not read from remote repository git@gitlab.com:权限被拒绝(公钥)。 致命:无法从远程存储库读取 - git@gitlab.com: Permission denied (publickey). fatal: Could not read from remote repository 对于 ssh 连接,在 Anaconda、Windows 中出现错误“无法加载密钥 ----,格式无效,权限被拒绝(公钥)” - For ssh connection, getting error "Failed to load key ----, invalid format, Permission denied (publickey)" in Anaconda, Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM