I've recently configured a build job in Jenkins that clones source code from GitHub. I accidentally entered an invalid Git repository URL and this is what Jenkins yelled at me:
Failed to connect to repository : Command "git ls-remote -h firstname.lastname@example.org:USER/REPO.git HEAD" returned status code 128: stdout: stderr: ERROR: Repository not found. fatal: The remote end hung up unexpectedly
Through this error I learned about git ls-remote and how it can be used to
- list references in a remote repository
- check that a repository exists at all
- check that a specific ref exists (use
All that without cloning the repository in question.