繁体   English   中英

如何通过 jenkins 克隆远程 git 存储库

[英]How to clone remote git repository through jenkins

I have installed git in the Linux server(Server1) and created a remote git repository in that server1 Now I need to clone the git repository to server2 through Jenkins so I installed Jenkins in the server2, Now Jenkins was hosted in server2.

In Jenkins I have created a freestyle project, In the Repository URL section, I entered the URL of git repo like: git@<server1_ip>:/opt/dev/repo/pals/ui.git

对于身份验证,我已经一一尝试了下面给出的每个凭据:

git repo username and password git repo username and SSH Private key Jenkins username and password Jenkins username and SSH Private key But I am facing the below error:

存储库 URL

git@<server1_ip>:/opt/dev/repo/pals/ui.git

无法连接到存储库:命令“git ls-remote -h -- git@<server1_ip>:/opt/dev/repo/pals/ui.git HEAD”返回状态码 128:stdout:stderr:权限被拒绝,请尝试再次。 权限被拒绝,请重试。 git@<server1_ip>:权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic、密码)。 致命:无法从远程存储库中读取。 请确保您具有正确的访问权限并且存储库存在。

git@<server1_ip>:/opt/dev/repo/pals/ui.git

那是一个 SSH URL,这意味着您需要:

  • register the private key in Jenkins server2 using the Jenkins SSH Credential plugin (try a passphrase-less key, to avoid any issue with SSH agent, for testing)
  • 确保server1:~git/.ssh/authorized_key中有公钥。

在 server2 上,您至少可以测试ssh -i /path/to/private/key git@server1以确保它首先工作。 然后从 Jenkins 测试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM