I following this tutorial https://www.jenkins.io/doc/tutorials/build-a-java-app-with-maven/#fork-sample-repository to create a Jenkins Pipeline.
My config for Pipeline section is
- Definition: Pipeline scrip from SCM
- SCM: git
=> Repository URL: I put my local path to my local repository according to the tutorial link mentioned above.
But I always get this error "Failed to connect to repository : Command "git ls-remote -h — file:///home/aaa/Projects/doit-webservice HEAD" returned status code 128:
stderr: fatal: ‘/home/aaa/Projects/doit-webservice’ does not appear to be a git repository
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists."
I am sure I entered correct git credential for that repo.
My guess is, I am using Jenkins on Docker and the path to access that local folder is incorrect.
I tested another laptop which running Jenkins without Docker and it working fine.
Source: Docker Questions