[英]Checkout Bitbucket Repo Branch in Jenkins
I am new with Jenkins and trying to create a pipeline and checkout the private BitBucket repository from Jenkins and then install dependencies and then create build.我是 Jenkins 的新手,我试图创建一个管道并从 Jenkins 签出私有 BitBucket 存储库,然后安装依赖项,然后创建构建。
But I am having issue in the first step while checkout the repository branch.但是在签出存储库分支时,我在第一步遇到了问题。
I have set the credentials and SSH link as well.我也设置了凭据和 SSH 链接。
Here is the Error:这是错误:
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'
Here is the code:这是代码:
pipeline {
agent any
stages {
stage('Git Checkout') {
steps {
git branch: 'master',
credentialsId: '<credentialIdsHere>', // changed
url: 'ssh://git@bitbucket.org:company/repo.git/' // changed
}
}
}
}
Also I have specify the git.exe path我也指定了 git.exe 路径
Assuming SSH is working, meaning you can execute manually a git ls-remote
(for instance) to that SSH URL, I would recommend the syntax (for said SSH URL):假设 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.