git push sporadically fails on Jenkins with “Device not configured” error

We are using Jenkins git plugin to clone git repo, with credentials, before the build.

At the end of the build, if it is successful, we do git push:

  • Git Repository Only Gets Bigger After Using BFG
  • Bonobo Git Server - HTTP Error 500.19 - Code: 0x80070021
  • git push… fatal: Unable to create master.lock: File exists
  • Convert two subversion repos on googlecode to a single git repo on github
  • how to sync a repo mirror to a new upstream repo
  • How to make automatic pull request with Sourcetree NOT in master branch?
  • BRANCH_TO_PUSH=${GIT_BRANCH/origin\//}
    git push origin HEAD:refs/heads/${BRANCH_TO_PUSH}
    

    Sporadically, the push fails with the following output:

    fatal: could not read Username for 'https://git.example.net': Device not configured
    

    How can this issue be solved?

  • Git push to live server through limited ssh
  • Version Control for Homework Assignments
  • How are rebases and merges “stateful” in Git?
  • Can git svn init handle sibling directories of trunk/branches/tags that should be part of base checkout
  • GitKraken is not showing repo I am a contributer to
  • ISO a version control tool that can manage files that are NOT under a directory tree marked as managed by the VC tool
  • One Solution collect form web for “git push sporadically fails on Jenkins with “Device not configured” error”

    The issue happens when the repo is configured to be cloned over HTTPS.
    If it only happens sporadically, it means that git is configured to use credential helper to store the credentials at clone time.

    However, by default the cache is set to 900 seconds (15 minutes). If your build takes longer than that, the push will fail.

    To raise the cache TTL to 60 minutes run this on your Jenkins machine:

    sudo su - jenkins
    git config --global credential.helper 'cache --timeout=3600'
    
    Git Baby is a git and github fan, let's start git clone.