簡體   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