频繁的ssh连接失败到github

时间:2015-03-23 23:32:19

标签: git github ssh jenkins

我注意到我的jenkins工作频繁失败,但并非始终如一。它可能是一个内部防火墙问题,但我想检查一下是否有人可以指出我到目前为止还没有检查过的东西。詹金斯的工作包括: 1. git fetch& 2.一个git标签

作业要么在#1失败,要么在#1成功,有时在#2失败,否则作业成功。

控制台日志,当它在#1上失败时:

> git fetch --tags --progress git@github.com:myorganization/myproject +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from git@github.com:myorganization/myproject
hudson.plugins.git.GitException: Failed to fetch from git@github.com:myorganization/myproject
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:627)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:865)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:890)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1259)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:622)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
    at hudson.model.Run.execute(Run.java:1759)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@github.com:myorganization/myproject +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

控制台输出失败@#2

Updated data_bag_item[dev::dev]
tagging git for env dev
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error occured:
  AutoTagger::Git::Repo::GitCommandFailedError (AutoTagger::Git::Repo::GitCommandFailedError)
/opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/lib/auto_tagger/git/repo.rb:58:in `exec'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/lib/auto_tagger/git/ref_set.rb:36:in `fetch'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/lib/auto_tagger/base.rb:40:in `fetch'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/lib/auto_tagger/base.rb:33:in `create_ref'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/lib/auto_tagger/command_line.rb:49:in `execute'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/gems/auto_tagger-0.2.10/bin/autotag:5:in `<top (required)>'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/bin/autotag:23:in `load'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/bin/autotag:23:in `<main>'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/bin/ruby_executable_hooks:15:in `eval'
  /opt/mount1/rvm/gems/ruby-2.1.1@oss/bin/ruby_executable_hooks:15:in `<main>'
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered

.. 我有两个jenkins奴隶有这个问题,我建立了另一个jenkins奴隶,第三个也显示了类似的问题。以下是我已经验证的内容:

  1. 执行构建作业的jenkins用户拥有github帐户中公钥的正确RSA私钥。我可以做一个ssh -T git@github.com就好了。

    [jenkins @ slave3~] $ ssh -T git@github.com 嗨myaccount!您已成功通过身份验证,但GitHub不提供shell访问权限。

  2. 下面是/home/jenkins/.ssh/config文件

    主持github.com   HostName github.com   用户git   IdentityFile~ / .ssh / myprivate-key   StrictHostKeyChecking no

  3. 我曾尝试使用端口443进行ssh连接,但我的网络似乎并不喜欢它。在我将配置文件更改为使用端口443之前,我使用命令

    手动测试
    ssh -T -p 443 git@github.com
    
    1. 我创建了一个基本的shell脚本,让它每10秒运行一次。它选择了ssh连接故障但不像我在jenkins上遇到的那样频繁。
    2. 注意:请不要将此标记为dup。我已经向github查询了一些连接问题:

      Jenkins: Failed to connect to repository

      Can't authenticate with GitHub

      但它们甚至不太相似

0 个答案:

没有答案