Git Plugin is not fetching repo using jenkinsfile

32 views Asked by At

Hy, I am using Git Plugin to fetch github code for jenkins pipeline. Actually I want to set load the branch dynamically from where the push event was triggered. Now, I have problem:

  1. When I configure git plugin > using jenkins UI repo URL & credentials and specify the branch in field then webhooks are working and fetching the code from the branch specified in the "Branch Specifier" at jenkins UI, but when i remove this UI configuration and want to add below code for configuration, then job is thorowing an error:

GIT PLUGIN CODE FOR PUBLIC REPO CONFIGURATION USED IN JENKINSFILE, Instead to use UI configuration:

(repo is public)

checkout scmGit( branches: [[name: 'my-branch']], userRemoteConfigs: [[url: 'https://github.com/jenkinsci/ws-cleanup-plugin']])

JENKINS CONSOLE ERROR:

Started by GitHub push by alisial45 Checking out git into /var/lib/jenkins/workspace/Sample Pipeline for webhooks@script/80b99c2f5bbf8b755643e9680374e300a46ad183dd90018b5a9bfe0459d1e324 to read Jenkinsfile Seen 0 remote branches

/usr/bin/git show-ref --tags -d # timeout=10 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. ERROR: Maximum checkout retry attempts reached, aborting Finished: FAILURE

0

There are 0 answers