Unable to Clone workflowLibs


I am unable to clone the global shared library for Pipeline.
I am encountering the following issue:

$ git clone ssh://USER@SERVER:SSHD/workflowLibs.git 
Cloning into 'workflowLibs'... 
fatal: could not fetch refs from ssh://USER@SERVER:SSHD/workflowLibs.git

Related Issue(s)


  • CloudBees Jenkins Enterprise


The issue occurs when trying to clone an empty repository. There is also a known issue JENKINS-32565 related to JGit. *(Note: JGit is deprecated: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-WhyNotJGit)*

1) Clone using http to perform the initial commit as suggested in Pipeline Global Library. This need to be done in an unauthenticated Jenkins which means you need to disable security.

2) Another workaround is to commit a file (any file) to the repository:

cd $JENKINS/workflow-libs
echo "Initial Commit" > README.md
git add .
git commit -a -m "Initial Commit"

Then you can clone the non-empty repository via SSH (remember that the SSHD port needs to be configured):

git clone ssh://USER@SERVER:SSHD/workflowLibs.git

Have more questions?


  • 0
    Manjeet Singh

    Can this be maintained under external git repository instead of maintaining the repo in Jenkins master ?

    Edited by Manjeet Singh
Please sign in to leave a comment.