簡體   English   中英

使用jenkins管道將Git拉到遠程服務器上

[英]Git pull on remote server using jenkins pipeline

我有這個git結帳階段,它工作正常

checkout([$class: 'GitSCM',
     branches: [[name: "*/master" ]],
     doGenerateSubmoduleConfigurations: false,
     extensions: [[$class: 'LocalBranch', localBranch: "**"]],
     submoduleCfg: [],
     userRemoteConfigs: [[credentialsId: env.GIT_CREDS, url: env.GIT_REPO]]
         ])

我想配置詹金斯的工作(使用詹金斯管道)使用sshagent我需要使用管道的遠程服務器上的git拉定義的GIT_CREDS需要這樣的東西做一個遠程服務器上的混帳拉

sh "ssh ubuntu@$Ip 'git pull'" 

使用GIT_CREDSGIT_REPO env變量

有人可以幫我這個

只需使用git

git(
    url: 'git@git.com:YourGitRepo.git',
    credentialsId: '5ef933f28-bdb2-0563-bfc7-b460490262735', // found here http://jenkinsURL:8080/credentials/
    branch: 'master'
    )

在內部它使用ssh。
希望能幫助到你 :)

暫無
暫無

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

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