2014-10-30 126 views
2

我一直在使用Git一段時間。Jenkins和Git配置問題

最近,我已經開始探索Jenkins,並設法使用本地Windows安裝程序進行設置。我在本地系統上創建了一個示例項目,併成功使用Jenkins構建它。

現在,我在遠程服務器上有一個項目,我想讓詹金斯使用Git來拉代​​碼。

我做了以下內容:

1)安裝了Git的插件。 enter image description here

2)在詹金斯>管理詹金斯>配置系統> GIT中> GIT中的安裝 -

enter image description here

[也嘗試C:\程序文件(x86)\ GIT中\ CMD \ gitk.cmd代替.... \ git.exe]

3)下的試驗項目>配置 enter image description here

4)最後,試圖建立它。但總是會出現超時錯誤,然後失敗。 enter image description here

Started by user anonymous 
Building in workspace C:\Program Files (x86)\Jenkins\workspace\GitTest 
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url ssh://[email protected]<the-url-to-the-server>demo_android.git # timeout=10 
Fetching upstream changes from ssh://[email protected]<the-url-to-the-server>demo_android.git 
> C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10 
> C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress ssh://[email protected]<the-url-to-the-server>demo_android.git +refs/heads/*:refs/remotes/origin/* # timeout=60 
FATAL: Failed to fetch from ssh://[email protected]<the-url-to-the-server>demo_android.git 
hudson.plugins.git.GitException: Failed to fetch from ssh://[email protected]<the-url-to-the-server>demo_android.git 
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:647) 
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:889) 
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:914) 
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1258) 
    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 "C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress ssh://[email protected]<the-url-to-the-server>demo_android.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: ssh: connect to host git.us1.adeptra.com port 7999: Bad file number 
fatal: Could not read from remote repository. 

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

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1435) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1223) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:85) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:280) 
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:645) 
    ... 10 more 

我在做什麼錯?我需要提供憑據嗎? (我試過它也失敗了)

+0

你能做出'混帳取--tags --progress SSH -

通過在鏈接中的說明刪除了密碼您的本地計算機上的服務器> demo_android.git'? – mithrop 2014-10-30 08:15:18

+0

是的。我導航到特定的目錄並執行命令。像往常一樣,它要求密碼,然後繼續並嘗試獲取 – senchaDev 2014-10-30 08:29:38

回答

0

您需要提供身份驗證。要麼通過使用純文本並將其填充到配置文件或命令行中,要麼使用證書 ssh-public-key來執行此操作。

在這裏,你可以找到關於如何將其連接到GitHub上a tutorial,我認爲它應該同樣地,對做你自己git-server

+0

我已經有我的本地系統上的id_rsa,id_rsa.pub和known_hosts文件。我應該在哪裏提供詹金斯身份驗證? – senchaDev 2014-10-30 11:14:18

+0

您需要驗證用戶jenkins作爲該用戶的測試運行。對我來說,在Linux上這將是詹金斯用戶本身,因此我必須將id_rsa密鑰文件設置在該用戶的正確位置,如下所示:home/jenkins/.ssh – MadManMonty 2014-10-30 11:28:49

+0

正在執行'git clone'-命令,應該將其(公共)ssh-key提交給** git服務器** – Highmastdon 2014-10-30 12:02:14