Jenkins 与 Git 存储库的集成
Jenkins integration with Git repository
我已经在我的centos服务器上安装了git 2.7。并在 /srv/repo.git 创建了存储库。我可以使用命令 ssh://user@serverIP:/srv/repo.git
.
克隆它
我已经在 Windows 10.
的本地计算机上安装了 jenkins & git
问题:
使用 jenkins.Please 设置 git 回购时遇到错误,请参见屏幕截图。
错误:
Failed to connect to repository : Command "git.exe ls-remote -h -- ssh://username@server_ip:/srv/repo.git HEAD" returned status code 128:
stdout:
stderr: ssh: Could not resolve hostname server_ip: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
请帮我解决这个问题。提前致谢。
您必须 'server_ip' 与您服务器的 IP 进行交换。
用户名也应该设置为正确的。
你说你可以这样克隆
ssh://user@serverIP:/srv/repo.git
但 Jenkins 正试图像这样克隆
ssh://user@server_ip:/srv/repo.git
我找到了这个问题的解决方案..jenkins 与 git 服务器的身份验证存在问题。只需使用以下步骤解决:
- 在本地机器上打开 git bash 并使用命令生成 public/private 密钥:ssh-keygen
- 将id_rsa.pub内容复制到C:\Users\your_windows_user_name这里。ssh\known_hosts
- 在 jenkins 中进入 Source Code Management->Git->Credentials add
- 在Jenkins中select Kind->SSH Username with private key, Enter directly -> Paste the private generated private key from the file
- 在 Linux 服务器上转到 .ssh/authorized_keys 并在此处粘贴 C:\Users\your_windows_user_name。ssh\id_rsa.pub 文件内容在此处
- 在 jenkins 项目配置中,转到“源代码管理”部分并选择 git->Repositary url-> 粘贴此 ssh://user@serverIP:/srv/repo .git
- Select 我们在第 1 步中创建的凭据。 3 & 4.
我已经在我的centos服务器上安装了git 2.7。并在 /srv/repo.git 创建了存储库。我可以使用命令
克隆它ssh://user@serverIP:/srv/repo.git
.我已经在 Windows 10.
的本地计算机上安装了 jenkins & git问题: 使用 jenkins.Please 设置 git 回购时遇到错误,请参见屏幕截图。
错误:
Failed to connect to repository : Command "git.exe ls-remote -h -- ssh://username@server_ip:/srv/repo.git HEAD" returned status code 128:
stdout:
stderr: ssh: Could not resolve hostname server_ip: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
请帮我解决这个问题。提前致谢。
您必须 'server_ip' 与您服务器的 IP 进行交换。
用户名也应该设置为正确的。 你说你可以这样克隆
ssh://user@serverIP:/srv/repo.git
但 Jenkins 正试图像这样克隆
ssh://user@server_ip:/srv/repo.git
我找到了这个问题的解决方案..jenkins 与 git 服务器的身份验证存在问题。只需使用以下步骤解决:
- 在本地机器上打开 git bash 并使用命令生成 public/private 密钥:ssh-keygen
- 将id_rsa.pub内容复制到C:\Users\your_windows_user_name这里。ssh\known_hosts
- 在 jenkins 中进入 Source Code Management->Git->Credentials add
- 在Jenkins中select Kind->SSH Username with private key, Enter directly -> Paste the private generated private key from the file
- 在 Linux 服务器上转到 .ssh/authorized_keys 并在此处粘贴 C:\Users\your_windows_user_name。ssh\id_rsa.pub 文件内容在此处
- 在 jenkins 项目配置中,转到“源代码管理”部分并选择 git->Repositary url-> 粘贴此 ssh://user@serverIP:/srv/repo .git
- Select 我们在第 1 步中创建的凭据。 3 & 4.