我无法让Jenkins通过SSH在BitBucket上克隆git存储库。出现以下消息失败:
Building in workspace /var/lib/jenkins/workspace/test [ssh-agent] Using credentials git (git@bitbucket.org:<user>/<repo>.git) [ssh-agent] Looking for ssh-agent implementation... [ssh-agent] Java/JNR ssh-agent [ssh-agent] Started. Checkout:test / /var/lib/jenkins/workspace/test - hudson.remoting.LocalChannel@2b619bca Using strategy: Default Fetching changes from 1 remote Git repository Fetching upstream changes from origin ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway hudson.plugins.git.GitException: Command "git fetch -t origin +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: ssh: connect to host bitbucket.org port 22: Connection refused fatal: The remote end hung up unexpectedly
git@bitbucket.org:<user>/<repo>.git
我也尝试过不使用凭据管理器并手动将密钥安装在中/var/log/jenkins/.ssh/,但无济于事。
/var/log/jenkins/.ssh/
有什么想法我做错了吗?
正如@ user1562655建议的那样,克隆由于另一个问题而失败-在这种情况下,防火墙阻止了端口22上的传出ssh。
解决方法是使用端口443(服务器允许这样做)和其他BitBucket URL:
ssh://git@altssh.bitbucket.org:443/<user>/<repo>.git
…代替
ssh://git@bitbucket.org:<user>/<repo>.git
有关该计划的更多信息,请参见:
在端口443上使用带有Bitbucket- SSH的SSH协议