2014-02-26 51 views
4

問題私人git的子模塊詹金斯沒有發現

我試圖建立我在詹金斯的應用程序,它是在Github上的私人回購,也有一個私人子模塊。

我可以通過設置它的憑據克隆在詹金斯私人倉庫,但詹金斯無法克隆的子模塊,這裏是一個構建失敗的輸出:

Started by an SCM change 
Building in workspace /var/lib/jenkins/jobs/Project/workspace 
Fetching changes from the remote Git repository 
Fetching upstream changes from [email protected]:user/repogit 
using GIT_SSH to set credentials 
Checking out Revision 9cc99b67cc676d0ea8ccd489a8327f5c6dbb8d7f (origin/branch) 
[workspace] $ /bin/sh -xe /tmp/hudson2710403018107019432.sh 
+ git submodule update --init --recursive 
Initialized empty Git repository in /var/lib/jenkins/jobs/repository/submodule/.git/ 
ERROR: Repository not found. 
fatal: The remote end hung up unexpectedly 
Clone of '[email protected]:user/submodule.git' into submodule path 'repository/submodule/' failed 
Build step 'Execute shell' marked build as failure 
Discard old builds... 
#156 is removed because status FAILURE is not to be kept 
Publishing Clover coverage report... 
No Clover report will be published due to a Build Failure 
Sending e-mails to: 
Finished: FAILURE 

這裏就是我試圖做詹金斯

  • 試圖設置附加行爲「高級子模塊的行爲」,但沒有成功。
  • 試圖與PHPUnit的運行測試之前設置了一個新臺階:

git submodule update --init --recursive

  • 試圖設置在我的子模塊的項目一個Git倉庫太大,不只是主存儲庫正在測試中,也沒有運氣。

所有這些導致錯誤,說詹金斯找不到子模塊的存儲庫。

如何解決這個問題的任何想法?

(用戶名,路徑和庫是正確的,我只是改變了他們張貼在這裏)

回答

4

解決。在我的證書中,我使用了一個直接的SSH密鑰(選項「直接輸入」),而不是放入文件中。

我剛剛把鑰匙(公共和私人)放在〜/ .ssh中,並將我的憑證更改爲選項「從詹金斯主〜/ .ssh」。

問題是子模塊未使用我已指定給主存儲庫的憑據,它試圖使用默認的ssh密鑰(.ssh/id_rsa)。

另一個解決方案是-i my_key傳遞給git的子模塊的步驟(只需要這個,如果你的關鍵不在默認路徑(的〜/ .ssh/id_rsa))

而且不要忘了給予你的密鑰正確的權限,在我的情況下,我不得不:

chown apache ~/.ssh/id_rsa* 
chmod 700 ~/.ssh/id_rsa* 
+0

那麼,有沒有辦法使用直接輸入? – Kostanos

+0

不是我發現..這是我得到它的唯一方法。 – Brayan

+0

確認,密鑰必須位於具有默認名稱(id_rsa和id_rsa.pub)的文件中。如果爲.ssh/config文件中的文件指定了非標準名稱,則初始克隆會成功,但子模塊更新將失敗。 – BitByteDog