2017-06-20 161 views
0

在我們的組織中,我們有本地託管的git。而對於我的項目,我需要在詹金斯的幫助下實施CI。我知道用GitHub配置jenkins,但不知道用本地git配置它。配置Jenkins的本地git

Repository URL我應該提供什麼?

在我的倉庫運行git remote show origin

命令後,我得到了類似下面

WARNING: previous mirror push of repo 'OPT' to host 'tregit1' failed, status is: 
2017-06-16.19:28:39  31417 ssh: connect to host 10.9.100.31 port 22: No route to host 
2017-06-16.19:28:39  31417 fatal: Could not read from remote repository. 
2017-06-16.19:28:39  31417 
2017-06-16.19:28:39  31417 Please make sure you have the correct access rights 
2017-06-16.19:28:39  31417 and the repository exists. 
---------- 
* remote origin 
    Fetch URL: gitbox:OPT 
    Push URL: gitbox:OPT 
    HEAD branch: master 
    Remote branch: 
    master tracked 
    Local branch configured for 'git pull': 
    master merges with remote master 
    Local ref configured for 'git push': 
    master pushes to master (up to date) 

,並運行此git remote -v命令的輸出像

origin gitbox:OPT (fetch) 
origin gitbox:OPT (push) 

我試着給Repository URLgitbox:OPT但Jenkins在輸入時出現以下錯誤gitbox:OPT

Failed to connect to repository : Command "git ls-remote -h gitbox:OPT HEAD" 
returned status code 128: 
stdout: 
stderr: ssh: Could not resolve hostname gitbox: Temporary failure in name resolution 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 

和存儲庫存在。

任何人都可以告訴我在Git URL中提供什麼?

+0

嘗試提供具有以下格式的網址:'git @ hostname:repo_name.git',並在此之前,確保配置git憑證(通過憑證插件) –

回答

0

簡單:當給別名時,ssh會尋找%HOME%/.ssg/config

如在「config」中,而不是「conf」。

確保HOME已定義(至C:\Users\AY)。並且你的ssh配置文件被命名爲「config」。

還測試如果ssh -i C:\Users\AY\.ssh\anish -T [email protected]確實工作。

我已經使用了gitolite.pub從Ubuntu的,我在Windows中創建anish.pub並添加這gitolite和改變conf/gitolite.conf如下圖所示回購

gitolite-admin RW+ = gitolite 
repo testing 
    RW+ = @all 
repo bigfastblog 
    RW+ = anish 

確保推動這一gitolite.conf回Ubuntu服務器,並檢查~gitolite/.ssh/authorized_keys確實列出了anish.pub的內容。
也是Windows HOME/.ssh應包括anish.pubanish(私鑰)

最後能夠克隆:這是HOME環境變量的問題。

+0

它不僅用於測試。我還需要使用Poll SCM進行配置。 –

+0

我已經明確地給你了我得到的日誌。它不是'Github'。我們已經在gitbox的幫助下在本地安裝了git。只是通過給'gitbox:OPT'顯示錯誤 –

+0

@ Ben.Bean,對不起,誤解,更新了答案,請檢查&恢復。 – LuFFy