jenkins 配置git,出现无法连接git仓库的情况
ERROR: Timeout after 10 minutes ERROR: Error cloning remote repo origin hudson.plugins.git.GitException: Command "git fetch --tags --progress git@github.com:ejenna/wsg.git +refs/heads/*:refs/remotes/origin/*" returned status code 143: stdout: stderr: at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:629) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186) at hudson.scm.SCM.checkout(SCM.java:504) at hudson.model.AbstractProject.checkout(AbstractProject.java:1208) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1819) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) ERROR: Error cloning remote repo origin
主要是~/.ssh/known_hosts中不存在已经访问过的记录,对于新的git需要手动验证一次之后,才能记录在~/.ssh/known_hosts中,下次就可以直接访问了
验证方法:
1、jenkins先跑一次项目,当他失败之后,项目的目录已经创建成功,git初始化成功
2、进入项目目录,一般是....../.jenkins/workspace/项目名称/,然后执行 git pull
3、会出现提示:Are you sure you want to continue connecting (yes/no)? 输入 yes
4、之后就可以正常访问了,去查看~/.ssh/known_hosts,多了一个ssh