簡體   English   中英

Jenkins:無法連接到Bitbucket Git存儲庫

[英]Jenkins: unable to connect to bitbucket git repository

我正在嘗試將詹金斯連接到bitbucket git存儲庫。

當我在jenkins中指定存儲庫URL時,它將返回以下錯誤消息:

Failed to connect to repository : 
Command "git ls-remote -h <SSH_Git_url> HEAD" returned status code 128: stdout: stderr: Host key verification failed. 
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

我已經使用Git Bash成功運行了上面的命令(運行jenkins的地方),並且known_hosts文件具有正確的主機地址和端口。

在運行上述命令之前,我還使用了set git_ssh_command="ssh -i <ActualPathToPrivateKey>" ,以檢查是否有幫助。

其他一些要點(不確定是否增加了這個問題,而是嘗試提供盡可能多的信息):

a. The public\private keys were created using the `ssh-keygen` command in the c:\users\<UserName>\.ssh folder. 
b. The public key was copied and added as a read\write access key for the repository in bitbucket.
c. Jenkins runs as a windows service and logs on as a "Local service account".

我可能做錯了什么?

更新:12/11/2018:

git版本是2.17.1.windows.2。

我嘗試了@VonC建議的選項,但出現以下相同錯誤。 在配置單個作業=>憑據下拉列表中,沒有任何顯示。

在此處輸入圖片說明

在此處輸入圖片說明

Jenkins作為Windows服務運行,並以“本地服務帳戶”登錄

這意味着在進行測試時,它可能無法訪問與您帳戶相同的環境變量。
確保在SSH憑據插件中注冊ssh密鑰。

並檢查您的Git版本:如果是2.19.2,則ssh-keygen命令已更改生成的密鑰格式(從PEM更改為openssh):請參閱“ Jenkins:憑據中私鑰的正確格式是什么 ”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM