Jenkins pipeline error timeout after 10 minutes

How to fix Error fetching remote repository ‘origin’ from Jenkins build jobs. In this tutorial, I will be fixing the Jenkins pipeline error timeout after 10 minutes.

Jenkins build job error code as below

ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
Caused by: hudson.plugins.git.GitException: Command "/usr/local/git/bin/git fetch --tags --progress https://gitlab.com/devopsroles.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:

Cause by

  1. incorrect credentials were provided with the Jenkins job definition.
  2. The repository is so large that it takes more than 10 minutes to clone.
  3. Bandwidth to the git server is slow enough that it takes more than 10 minutes to clone.

Jenkins pipeline error timeout after 10 minutes fixed

stage('Getsource') { // for display purposes
    // Get some code from a GitHub repository
    checkout([$class: 'GitSCM',
        branches: [[name: "${TARGET_BRANCH}"]],
        extensions: [[$class: 'CloneOption', timeout: 120]],
        gitTool: 'Default', 
        userRemoteConfigs: [[credentialsId: 'w55f8df9-0183-4b80-96d8-917ccccccccccc', url: 'https://gitlab.com/devopsroles.git']]
    ])
}

In my example, I will Increase the timeout is 120 minutes for the Git checkout source from the repository.

Conclusion

Through the article, you have solved the problem of Jenkins pipeline error timeout after 10 minutes as above. I hope will this your helpful.

Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.