美文网首页
Coding代码自动同步推送gitee、github

Coding代码自动同步推送gitee、github

作者: CCSHCoder | 来源:发表于2021-12-09 09:50 被阅读0次
image.png
image.png
image.png
image.png

替换成下方配置

pipeline {
  agent any
  stages {
    stage('检出') {
      steps {
        checkout([
          $class: 'GitSCM',
          branches: [[name: env.GIT_BUILD_REF]],
          userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]
        ])
      }
    }
    stage('推送部署') {
      steps {
        echo '正在推送文件...'
        sh 'git fetch https://用户名:申请的token@gitee.com/用户名/仓库名.git'
        sh 'git push -f https://用户名:申请的token@gitee.com/用户名/仓库名.git HEAD:master'
        echo '已完成文件推送.'
      }
    }
  }
}

@后面就是你要推送到的仓库地址带有.git

相关文章

网友评论

      本文标题:Coding代码自动同步推送gitee、github

      本文链接:https://www.haomeiwen.com/subject/zuxffrtx.html