2013-03-29 38 views
31

我想在Windows Server 2012機器上設置Jenkins,並且遇到很多困難。詹金斯掛在「從原點獲取上游變化」

我做的事:

  • 創建一個密碼的id_rsaid_rsa.pub
  • 創建使用ssh.exe -T bitbucket.org並接受添加主機known_hosts文件bitbucket.org。
  • 增加E:全系統的HOME變量
  • 我已經添加了這些文件C:/Windows/SysWOW64/config/systemprofile/.ssh以及E:/.ssh
  • 我聯繫我的公鑰到位桶作爲部署的關鍵。
  • 我有三重檢查了所有我的網址,用戶名等
  • 我甚至手動從倉庫拉到建立的初始基地C:/Program Files (x86)/Jenkins/jobs/MyProject/workspace/

然而它仍然在

掛起
Building in workspace C:\Program Files (x86)\Jenkins\jobs\MyProject\workspace 
Checkout:workspace/C:\Program Files (x86)\Jenkins\jobs\MyProject\workspace - [email protected] 
Using strategy: Default 
Fetching changes from 1 remote Git repository 
Fetching upstream changes from origin 

我給了它大約20分鐘,所以它不是回購問題的速度/大小。如果我取消,這是返回什麼:

ERROR: Problem fetching from origin/origin - could be unavailable. Continuing anyway 
hudson.plugins.git.GitException: Error performing command: C:\Program Files  (x86)\Git\bin\git.exe fetch -t origin +refs/heads/*:refs/remotes/origin/* 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:780) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:739) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.fetch(CliGitAPIImpl.java:160) 
at hudson.plugins.git.GitAPI.fetch(GitAPI.java:230) 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:793) 
at hudson.plugins.git.GitSCM.access$000(GitSCM.java:57) 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:976) 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942) 
at hudson.FilePath.act(FilePath.java:865) 
at hudson.FilePath.act(FilePath.java:838) 
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1364) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:670) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:575) 
at hudson.model.Run.execute(Run.java:1575) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 
at hudson.model.ResourceController.execute(ResourceController.java:88) 
at hudson.model.Executor.run(Executor.java:237) 
Caused by: java.lang.InterruptedException 
at java.lang.ProcessImpl.waitFor(Native Method) 
at hudson.Proc$LocalProc.join(Proc.java:319) 
at hudson.Launcher$ProcStarter.join(Launcher.java:360) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:769) 
... 19 more 
ERROR: Could not fetch from any repository 
FATAL: Could not fetch from any repository 
hudson.plugins.git.GitException: Could not fetch from any repository 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:981) 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942) 
at hudson.FilePath.act(FilePath.java:865) 
at hudson.FilePath.act(FilePath.java:838) 
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1364) 
at  hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:670) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:575) 
at hudson.model.Run.execute(Run.java:1575) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 
at hudson.model.ResourceController.execute(ResourceController.java:88) 
at hudson.model.Executor.run(Executor.java:237) 

我在這裏我束手無策,所以我感謝所有幫助我能。 這裏有幾個我已經嘗試過沒有任何改進的文章。

Authenticate Jenkins CI for Github private repository

Permission denied (publickey) when setting up Jenkins

Hudson Git Plugin not working on windows

http://computercamp.cdwilson.us/jenkins-git-clone-via-ssh-on-windows-7-x64

+0

這是一個PATH問題? (http://blog.cgdecker.com/2011/02/git-clone-error-on-jenkinshudson-on.html) – VonC

+0

從Jenkins的運行實例中檢查HOME(如http://blog.hlyh .dk/2011/07/debugging-hudson-git-plugin-hanging.html) – VonC

+0

我也有這個問題。令人沮喪的是,它有時會起作用,有時卻不起作用。所以一切都必須正確配置,但它只是隨機失敗。 –

回答

31

以下是我固定一個類似的問題:

Msysgit安裝兩個git.exe。一個在C:\Program Files (x86)\Git\bin之下,另一個在C:\Program Files (x86)\Git\cmd之下。第一個不能與詹金斯一起使用。它會在完成它的工作後掛起。第二個完美的作品。

更新您的Jenkins Git設置以指向正確的cmd\git.exe並享受!

+1

它的工作!謝謝!! – 3lRicko

+1

英雄,謝謝!!! –

+0

謝謝!像魅力一樣工作。 – GDefender

2

剛剛體驗凍結'取得上游從原點的變化'以及。

在基於Windows的計算機上運行Jenkins作爲服務似乎(從我所經歷的)在使用SSL時遇到問題。

解決方法解決方法]

  1. 改變你的詹金斯服務在本地帳戶下運行。
  2. 確保您的本地管理員帳戶配置爲與SSH執行Git交互。
  3. 重啓詹金斯(details)。
  4. 如果詹金斯沒有啓動,它試圖從Git拉出問題。手動殺死git和ssh進程,從Jenkins殺死你的java.exe並手動啓動Jenkins服務。爲什麼我選擇這個解決方案]

    我跟隨其他步驟與建立授權的主機接受服務器和註冊詹金斯的服務器上的關鍵允許連接之前

詳細信息。我確定我可以在我的本地系統帳戶(Jenkins服務運行於其下)下成功執行Git操作。儘管如此,抓取會凍結。爲了檢查我的Git和SSL配置是否正確,我甚至到了Jenkins作業目錄中最初配置的Git存儲庫,並執行了成功的請求under the local system account。有效;因此按鍵設置正確。

我忘了,我看這個,但聽說在本地系統使用Git/SSH打交道時出現的問題。有了這些知識,我打我的Git的環境,改變了GIT_SSH環境變量使用plink(用膩子的組合來記住服務器密鑰,的puttygen到OpenSSL的密鑰轉換爲膩子鍵和選美記住我的鑰匙)的砰砰。一旦我與plink合作,我就沒有發現它是一個可用的解決方案。爲了正確使用plink,我還必須在我的本地系統帳戶下運行pageant,讓Jenkins服務正確協商SSH調用。在思考如何在重新啓動時正確設置我的初始狀態之後,我不想將所有這些努力都放在獲取SSH連接的工作上。

相反,我決定是容易只是運行詹金斯在其下還配置處理Git的服務器我的本地管理員帳戶。無需處理本地系統帳戶的配置SSH密鑰和我的git操作就能正常工作。


請注意,David Gageot的答案可以適用於某些人。當我安裝Git時,我不必更改任何Git設置,我選擇Run Git from the Windows Command Prompt選項,該選項將路徑映射到C:\Program Files (x86)\Git\bin\cmd\目錄。

2

,我使用MSI安裝程序時,在Windows上配置詹金斯時,特別是發現了非常有益的另一個環節是:http://opensourcetester.co.uk/2013/06/28/jenkins-windows-ssh/

,另一種我沒有找到明顯的是更多的事情:你需要使用SSH網址當連接到Github而不是默認的https時。希望這會節省時間給某人。

2

我對我的筆記本電腦同樣的問題,我能找出一個解決方案,但是這個,如果你正在運行在Tomcat Web容器是設置爲Windows服務的詹金斯戰爭真的只適用。

我不得不設置Tomcat服務登錄我的Windows用戶,而不是本地系統。

8

這是我如何解決它:

我跑的Sysinternals工具PSEXEC產卵這是在LocalSystem帳戶下運行CMD(同一帳號像詹金斯服務正在運行)

PSEXEC -i -s -d CMD 

在這cmd提示符我執行了與掛起的GIT.exe進程相同的工作空間目錄下的相同git命令。例如。

d:\ Programs \ Jenkins \ jobs \ jobname \ workspace> D:\ Programs \ Git \ bin \ git.exe fetch -t ssh + git://[email protected]:9360/data/gitpub/myRepository.git +裁判/頭/ :裁判/遙控器/產地/

的Et瞧:我被提示輸入「是」 SSH密鑰添加到已知主機的已知列表。

1

對我來說,它是$ HOME/.ssh文件夾及其內容的權限。將它設置爲可見於特定用戶組後,Jenkins能夠在重新啓動後獲取更改。

0

Version 2.6.1 of the Git client for Windows修復了詹金斯的這個問題。現在「從原點獲取上游變更」不會有任何延遲。

我現在用的是git的cmd在詹金斯從:

C:\ Program Files文件\的Git \ CMD \ git.exe

0

我花了幾個小時試圖弄清楚這一點,我發現,添加密碼回購網址解決了該問題:

https://USERNAME:[email protected]/REPO.git 

請注意:用戶名和密碼之間