我正在尝试从Jenkins的GitHub Enterprise中设置一个存储库作为默认拉取源。在我们的项目中,Jenkins用于在我们推动一些更改时自动构建整个代码库。在我们的项目空间使用本地安装的GIT之前。现在我们正在迁移到GHE。
我在Configure
>所做的更改Source Code Management tab
> Repository URL
> git@github.com:project/repo
。
强制Build Now
之后我们收到了日志错误:
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress git@github.com:project/repo +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:ZjDIk3kbdyojRjqiBBfXS6xOHF+y+9bzcbZypukADHA.
Please contact your system administrator.
Add correct host key in <jenkins_home>/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in <jenkins_home>/.ssh/known_hosts:49
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
X11 forwarding is disabled to avoid man-in-the-middle attacks.
ERROR: Permission to project/repo.git denied to deploy key
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我的Jenkins没有任何读/写权限,请求我们的Jenkins管理员根据错误删除<jenkins_home>/.ssh/known_hosts
处的第49行。
他已经这样做了,他也与我们分享了id_rsa.pub
和id_ecdsa.pub
。
试图将这些键添加为project / repo上的Deploy键。
id_rsa.pub
,我收到了Key is already in use
条消息。 id_ecdsa.pub
已成功添加为部署密钥。但我仍然收到错误消息:
Failed to connect to repository : Command "git ls-remote -h git@github.com:project/repo HEAD" returned status code 128:
stdout:
stderr: ERROR: Permission to project/repo.git denied to deploy key
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
还通过在GHE中存储Jenkins服务器的存储库特定路径来尝试Webhooks
,但未发现任何更改:
https://<jenkins_server>:8080/job/<repo_name>/
建议/帮助将受到高度赞赏。谢谢!
答案 0 :(得分:0)
看起来你正在使用多个键。 除非另有说明,否则SSH将加载默认密钥。
如果您有多个身份文件,请创建SSH配置文件机制,以便为各种身份创建别名。
您可以使用许多参数和不同方法构建SSH配置文件。
此示例中使用的别名条目的格式为:
Host alias HostName <domain.com> IdentityFile ~/.ssh/identity
要为两个身份(workid和personalid)创建配置文件,您可以执行以下操作:
Open a terminal window.
Edit the ~/.ssh/config file.
如果您没有配置文件,请创建一个。
为每个标识组合添加别名,例如:
Host host1
HostName <domain1>
IdentityFile ~/.ssh/key1
Host host2
HostName <domain2>
IdentityFile ~/.ssh/key2
在您的情况下,域名应该相同并添加2个密钥:id_rsa
,id_ecdsa
答案 1 :(得分:0)