Started by user Raghav Bhardwaj [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/jenkins_home/workspace/Python_Hello [Pipeline] { [Pipeline] stage [Pipeline] { (Checkout) [Pipeline] checkout The recommended git tool is: NONE using credential 4f04306a-4af7-493c-9635-da71f3e4547a > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/Python_Hello/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url GitHub - raghav-bhardwaj/python # timeout=10 Fetching upstream changes from GitHub - raghav-bhardwaj/python > git --version # timeout=10 > git --version # ‘git version 2.39.2’ using GIT_ASKPASS to set credentials > git fetch --tags --force --progress – GitHub - raghav-bhardwaj/python +refs/heads/:refs/remotes/origin/ # timeout=10 > git rev-parse refs/remotes/origin/main^{commit} # timeout=10 Checking out Revision d2ac2fa35c063033b5196b951d762dd340ffa5f7 (refs/remotes/origin/main) > git config core.sparsecheckout # timeout=10 > git checkout -f d2ac2fa35c063033b5196b951d762dd340ffa5f7 # timeout=10 Commit message: “Create main.py” > git rev-list --no-walk d2ac2fa35c063033b5196b951d762dd340ffa5f7 # timeout=10 [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Build) [Pipeline] git The recommended git tool is: NONE using credential 4f04306a-4af7-493c-9635-da71f3e4547a > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/Python_Hello/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url GitHub - raghav-bhardwaj/python # timeout=10 Fetching upstream changes from GitHub - raghav-bhardwaj/python > git --version # timeout=10 > git --version # ‘git version 2.39.2’ using GIT_ASKPASS to set credentials > git fetch --tags --force --progress – GitHub - raghav-bhardwaj/python +refs/heads/:refs/remotes/origin/ # timeout=10 > git rev-parse refs/remotes/origin/controller^{commit} # timeout=10 > git rev-parse origin/controller^{commit} # 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 [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: Couldn’t find any revision to build. Verify the repository and branch configuration for this job. Finished: FAILURE
I think that you may have failed to declare the name of the branch that needs to be checked out by Jenkins. Jenkins assumes the most typical default branch name, but your repository uses a newer default branch name, “main”.
I see the message “ERROR: Couldn’t find any revision to build” if I try to run a Jenkins Pipeline that looks like this:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'https://github.com/raghav-bhardwaj/python'
}
}
}
}
That failure message is fixed when I run a Jenkins Pipeline that looks like this:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git branch: 'main',
url: 'https://github.com/raghav-bhardwaj/python'
}
}
}
}
An even better syntax would be:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scmGit(branches: [[name: 'main']],
userRemoteConfigs: [[url: 'https://github.com/raghav-bhardwaj/python']])
}
}
}
}
The Pipeline snippet syntax generator will help you generate that syntax. A 90 second video is available that demonstrates the Pipeline syntax snippet generator for the git pluigin
If that doesn’t resolve the issue for you, then you’ll need to provide more details. Details like:
- What type of job are you running?
- What are the details of the job definition?
- What Jenkins version are you running?
- What plugin versions are you using?
- What operating system is running the Jenkins controller?
- What Java version is running the Jenkins controller?
Please, please make it easier for others to help by posting a detailed description of the steps that you tried and the results you saw.
Please post things in a format that others can read them with the line breaks that are included in the original text, instead of posting them so that all the text is wrapped into a single line. I made my guess about the Pipeline definition because there was (thankfully) a public GitHub URL in your log output that could be used to make guesses about what happened.