繁体   English   中英

在 Jenkins 中签出 Bitbucket Repo 分支

[英]Checkout Bitbucket Repo Branch in Jenkins

我是 Jenkins 的新手,我试图创建一个管道并从 Jenkins 签出私有 BitBucket 存储库,然后安装依赖项,然后创建构建。

但是在签出存储库分支时,我在第一步遇到了问题。
我也设置了凭据和 SSH 链接。

这是错误:

The recommended git tool is: NONE
using credential 02cb4299-3a20-424f-a541-1771e5b2e0b9
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe rev-parse --resolve-git-dir C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\SCM-Pipline\.git # timeout=10
Fetching changes from the remote Git repository
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe config remote.origin.url ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/ # timeout=10
Fetching upstream changes from ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe --version # timeout=10
git --version # 'git version 2.37.0.windows.1'
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe fetch --tags --force --progress -- ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/ +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'

这是代码:

pipeline {
 agent any
  stages {
  stage('Git Checkout') {
  steps { 
    git branch: 'master',
        credentialsId: '<credentialIdsHere>', // changed
        url: 'ssh://git@bitbucket.org:company/repo.git/' // changed
   }
  }
 }
}

我也指定了 git.exe 路径

在此处输入图像描述

假设 SSH 正在工作,这意味着您可以手动执行git ls-remote (例如)到该 SSH URL,我会推荐语法(对于所说的 SSH URL):

ssh://git@bitbucket.org/company/repo.git
                      ^^^ (/, not :)
# or
git@bitbucket.org:company/repo.git/
                ^^^ (OK, but no ssh:// prefix)

暂无
暂无

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

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