简体   繁体   English

Git 与 Jenkins 集成

[英]Git integration with Jenkins

I am creating a Jenkins pipeline.我正在创建一个 Jenkins 管道。

But in pipeline when I select Git and give repository it gives me following error但是在管道中,当我 select Git 并提供存储库时,它给了我以下错误

Failed to connect to repository: Error performing command: git ls-remote -h https://github.com/trushant-dw/aushitosh.git HEAD无法连接到存储库:执行命令时出错:git ls-remote -h https://github.com/trushant-dw/aushitosh.ZBA9F11ECC3497D9993B933FDC2BD6E

I have added my git credentials in gobal credentials but not sure still why it's throwing this error.我已在 gobal 凭据中添加了我的 git 凭据,但仍不确定为什么会引发此错误。

Below is my pipeline下面是我的管道

node {
    stage 'Checkout'
        git 'git@github.com:trushant-dw/dockerwebapp.git'
    stage 'Docker build'
        docker.build('demo-docker')
    stage 'Docker push'
        docker.withRegistry('https://944198216610.dkr.ecr.us-east- 
        1.amazonaws.com', 'ecr:us-east-1:demo-ecr-credentials') {
            docker.image('demo').push('latest')
        }
}

I installed git in my jenkins server.我在我的 jenkins 服务器中安装了 git。

$ yum install git
$ which git
  /usr/lib/git

And then in Manage Jenkins ---> Global config tools ----> Git i have added the path.It worked for me.然后在管理 Jenkins ---> 全局配置工具 ----> Git 我添加了路径。它对我有用。

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

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