2012-08-30 57 views
22

我是Jenkins的新手,我在從GitHub克隆存儲庫時出現以下錯誤。詹金斯在從gitHub克隆時給出錯誤

我試圖在這裏搜索所有相關的問題,但可以找到確切的stacktstrace與答案。

我想克隆需要用戶名和密碼的存儲庫,我在作業配置設置中提供SSH://存儲庫路徑。我還沒有做任何.ssh相關的設置,因爲這似乎與GIT存儲庫的安全問題不同。

我找不出Jenkins試圖執行什麼註釋,哪個文件/目錄沒有發現無知。

下面是從詹金斯的工作我的確切堆棧跟蹤:

Caused by: java.io.IOException: Cannot run program: Error trying to determine the git version: Error performing command: --version Assuming 1.6 ERROR: Error cloning remote repo 'myRE' : Could not clone [email protected]:myORG/RVL.myProj.git hudson.plugins.git.GitException: Could not clone [email protected]:myORG/RVL.myProj.git at hudson.plugins.git.GitAPI.clone(GitAPI.java:268) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1122) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064) at hudson.FilePath.act(FilePath.java:842) at hudson.FilePath.act(FilePath.java:824) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064) at hudson.model.AbstractProject.checkout(AbstractProject.java:1256) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494) at hudson.model.Run.execute(Run.java:1502) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Caused by: hudson.plugins.git.GitException: Error performing command: clone -o RVL.myProj [email protected]:myORG/RVL.myProj.git /var/lib/jenkins/jobs/myProj/workspace at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:862) at hudson.plugins.git.GitAPI.access$000(GitAPI.java:40) at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:264) at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:244) at hudson.FilePath.act(FilePath.java:842) at hudson.FilePath.act(FilePath.java:824) at hudson.plugins.git.GitAPI.clone(GitAPI.java:244) ... 13 more Caused by: java.io.IOException: Cannot run program "": error=2, No such file or directory at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.(Proc.java:244) at hudson.Proc$LocalProc.(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:709) at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$ProcStarter.join(Launcher.java:345) at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:843) ... 19 more Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(Unknown Source) at java.lang.Pro

+0

如果您在Jenkins主控的命令行鍵入「git --version」,會發生什麼?這看起來像你沒有安裝git。 – CIGuy

+1

看起來像Jenkins的GIT配置有問題,給了GIT的完整路徑而不是隻有「git」(由jenkins建議) – Kaunteya

回答

42

我遇到並固定了同樣的問題:)

有配置的git的路徑雙向:

  1. 在詹金斯大師

    一個。進入Jenkins系統配置(Jenkins - >管理Jenkins - >配置系統)

    b。找到Git的項目和配置git的安裝(指定的詹金斯主git的路徑)

  2. 在詹金斯從

    一個。輸入詹金斯奴隸的配置

    b。檢查「工具位置」複選框並指定Jenkins從站上的git路徑。

在我的情況下,我沒有權限訪問詹金斯大師。所以我在Jenkins Slave上安裝git並將它添加到Jenkins Slave的配置中。

+2

+1,非常好的答案。解決方案#2對我來說工作得很好。 – Jonik

+0

對我來說,git路徑選項在Manage Jenkins - >全局工具配置 –

2

我經歷了同樣的問題。

我發現的git配置的混合在各個作業「/var/lib/jenkins/jobs/job_name/config.xml」:

[[email protected] jobs]# find . -maxdepth 2 -name  config.xml|xargs grep '<gitTool>' 
./job1/config.xml: <gitTool>git</gitTool> 
./job2/config.xml: <gitTool>Default</gitTool> 
./job3/config.xml: <gitTool>git</gitTool> 
./job4/config.xml: <gitTool>Default</gitTool> 

所以我固定gitTool的名稱,並重新啓動詹金斯。它看起來像git配置不正確,git的變化不會傳播到所有作業。

另外請注意,git配置可以在配置和Jenkins的webface中的配置的.xml文件中有所不同!

0

我遇到同樣的問題來了我創建了一個新的JOB後,固定它Label ExpressionRestrict where this project can be run下修正從屬名稱(與GIT安裝)。