【发布时间】:2018-02-02 10:26:42
【问题描述】:
我正在尝试配置 Jenkins 以使用 Atlassian Stash。我已经(显然)让 Git 插件成功 ping Stash,因为 Git 插件页面不再有任何错误消息。我正在使用带有 SSH 的 Git,并且我已经使用正确的 SSH 密钥配置了我的 Stash 帐户。我还应该提到我的办公室位于防火墙后面,因此是 Stash 的代理服务器。下面是 Jenkins Git 配置的截图:
默认 10 分钟超时后,控制台输出指示失败。以下是控制台输出的内容:
> C:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress ssh://git@stash.someproxy.com:7999/project/myrepo.git
+refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress ssh://git@stash.someproxy.com:7999/project/myrepo.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn
...
当我直接从 Windows bash 运行以下 Git 命令时,它很快完成,尽管没有输出:
$ time git fetch --tags --progress
ssh://git@stash.someproxy.com:7999/pcb_imst/
wigbotsimulator.git +refs/heads/*:refs/remotes/origin/*
real 0m5.530s
user 0m0.093s
sys 0m0.062s
此外,当我从 Jenkins 中删除凭据并尝试构建时,我几乎立即收到身份验证错误 (Permission denied (publickey))。因此,Jenkins 似乎可以命中 Stash,尽管它似乎无法完成一次提取。
我不知道如何解决这个问题。奇怪的是,Git 在本地工作,但在 Jenkins 使用时却不起作用。
【问题讨论】:
-
ssh -T git@stash.someproxy.com -p 7999 是否对您进行身份验证(意味着您会收到一些说明您的帐户的欢迎消息?)
-
@VonC 它只是挂在我能看到的地方。
-
您可以尝试使用该服务器的 IP,而无需任何代理参考吗?
-
@VonC 我无法使用
ssh -T git@xxx。当我尝试做ssh -T git@stash.someproxy.com -p 7999时,我得到了回复no address associated with name。但是你能解释一下为什么我可以从同一个控制台通过 SSH 与 Stash 通信吗?我刚刚验证了git fetch使用 SSH 证书工作。 -
它是否也适用于 git clone (在命令行中)。顺便说一句,你需要凭证吗?如果您的公钥已注册,并且您的私钥没有任何密码,则您不需要额外的凭据。
标签: git jenkins ssh bitbucket-server