首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:拒绝部署密钥的项目/repo.git权限

错误:拒绝部署密钥的项目/repo.git权限
EN

Stack Overflow用户
提问于 2017-04-10 16:19:31
回答 2查看 2.3K关注 0票数 0

我正在尝试将Jenkins中的GitHub企业的一个存储库设置为默认的拉源。在我们的项目中,Jenkins习惯于在我们推动某些更改时自动构建整个代码库。在我们在项目空间使用本地安装的GIT之前。现在我们要迁移到他。

我在Configure > Source Code Management tab > Repository URL > git@github.com:project/repo上做的改变。

在一个强有力的Build Now之后,我们得到了日志错误:

代码语言:javascript
复制
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.pubid_ecdsa.pub。尝试将这些密钥添加为项目/回购上的部署密钥。

  • 对于id_rsa.pub,我收到一条Key is already in use消息。
  • 但是id_ecdsa.pub作为deploy成功地添加了。

但我还是收到了一条错误信息:

代码语言:javascript
复制
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.

还尝试了通过将Jenkins服务器的特定存储库路径存储在Webhooks上,但没有发现任何更改:

https://<jenkins_server>:8080/job/<repo_name>/

建议/帮助将受到高度赞赏。谢谢!

EN

回答 2

Stack Overflow用户

发布于 2017-04-10 16:25:37

看上去你用的是多个键。除非另有通知,SSH将加载默认密钥。

创建SSH配置文件

当您有多个标识文件时,创建一个SSH配置文件机制来为您的各种身份创建别名。 您可以使用许多参数和不同的方法构造SSH配置文件。 本例中使用的别名条目的格式是: 主机别名HostName IdentityFile ~/..ssh/identity 要为两个标识(workid和personalid)创建一个配置文件,您可以执行以下操作:

代码语言:javascript
复制
Open a terminal window.
Edit the ~/.ssh/config file. 

如果您没有配置文件,请创建一个配置文件。

为每个标识组合添加别名,例如:

代码语言:javascript
复制
Host host1
HostName <domain1>
IdentityFile ~/.ssh/key1

Host host2
HostName <domain2>
IdentityFile ~/.ssh/key2

在您的例子中,域应该是相同的,并添加您的两个键:id_rsaid_ecdsa

票数 1
EN

Stack Overflow用户

发布于 2021-05-28 06:28:48

编辑ssh配置:

代码语言:javascript
复制
nano ~/.ssh/config

设置IdentitiesOnly=no

代码语言:javascript
复制
Host *
        IdentitiesOnly=no

(多亏了CodeWizard)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43328262

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档