'Windows 10 Jenkins Pipeline Failed to connect to repository

I am getting started learning Jenkins and am following this "simple" tutorial found within the Jenkins documentation; it's a tutorial which goes through how to get a simple java-maven-jenkins setup working locally. I followed the tutorial instructions carefully and have gotten the needed git repository forked and cloned for myself as well as Jenkins started on my localhost, but I ran into a wall when I reached this part:

Create your Pipeline project in Jenkins where on step 8:

"In the Repository URL field, specify the directory path of your locally cloned repository above, which is from your user account/home directory on your host machine, mapped to the /home directory of the Jenkins container - i.e.

For macOS - /home/Documents/GitHub/simple-java-maven-app

For Linux - /home/GitHub/simple-java-maven-app

For Windows - /home/Documents/GitHub/simple-java-maven-app"

I am using Windows 10 with GitHub Desktop and made sure that the repository was in the required place following the tutorial, but when I try to put the Repository URL as /home/Documents/GitHub/simple-java-maven-app (as the tutorial is asking to do), I get the following error within Jenkins: Failed to connect to repository: Command "git ls-remote -h /home/Documents/GitHub/simple-java-maven-app HEAD" returned status code 128: stdout: stderr: fatal:'/home/Documents/GitHub/simple-java-maven-app' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access right and the repository exists.

I tried searching for others with the same problem but could only find something related to solving problems with Unix-systems.

This question I found has a similar problem encountered, but I was not able to solve this problem on my system, as it focuses on Unix systems as well.

Another weirdness (to my eyes) was that Jenkins asks for the remote repository URL according to the help button, but the tutorial insists to put the local repository as the URL. As I am very new with Jenkins, it would be much appreciated if someone could enlighten me how to fix this to be able to finish the tutorial. Also because I am new with Jenkins, I hope who ever can help can really try to explain the solution in layman terms.

Cheers



Solution 1:[1]

Instead of using %HOMEPATH% in docker run command use c:\Users\ for mounting volume. After that docker will ask you permission allow it and enter your password. it will work.

Solution 2:[2]

I spent several hours trying to figure this out but I just did. If you followed the step to clone the repository to C:\Users\<your-username>\Documents\GitHub\ then that is good. Also, in Jenkins if you followed the step to set the Repository URL to /home/Documents/GitHub/simple-python-pyinstaller-app that is also good. When starting the jenkins-blueocean docker you need to do the following,

```
docker run --name jenkins-blueocean --rm --detach ^
  --network jenkins --env DOCKER_HOST=tcp://docker:2376 ^
  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 ^
  --volume jenkins-data:/var/jenkins_home ^
  --volume jenkins-docker-certs:/certs/client:ro ^
  --volume C:/Users/<your-username>/:/home ^
  --publish 8080:8080 --publish 50000:50000 myjenkins-blueocean:2.319.3-1
```

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nirav bhanushali
Solution 2