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 windows add symlink file as file
  • Android - The prefix “xmlns” cannot be bound to any namespace explicitly; neither can the namespace for “xmlns” be bound to any prefix explicitly
  • Git Publisher “target remote name” validation problems, single repo
  • How can I switch my git repository to a particular commit
  • How to make a new branch in Visual Studio 2015?
  • Update local master to remote master from another 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 '': Device not configured

    How can this issue be solved?

  • push changes without pull
  • Modular Maven projects and multiple Git repositories
  • How to have a buildbot GitPoller change source watch all branches?
  • Pushing to Github from RStudio
  • Push a branch of a git repo to a new remote (github), hiding its history
  • Is it safe for multiple users to use a Git repo on a shared network drive?
  • 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.