gpt4 book ai didi

Git 使用 jenkins 管道 pull 远程服务器

转载 作者:太空狗 更新时间:2023-10-29 14:21:53 26 4
gpt4 key购买 nike

我在 git checkout 阶段有这个,它工作正常

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

我正在尝试配置 jenkins 作业(使用 jenkins 管道)以使用 sshagent 在远程服务器上执行 git pull我需要使用在远程服务器上的 git pull 管道中定义的 GIT_CREDS需要这样的东西:

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

使用 GIT_CREDSGIT_REPO 环境变量

谁能帮我解决这个问题

最佳答案

只需使用 git

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

它在内部使用 ssh。
希望对您有所帮助:)

关于Git 使用 jenkins 管道 pull 远程服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51140468/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com