I am completely new to Jenkins (and Stackoverflow) and I am setting up a simple Jenkins job to poll a git repository.
1) I created a git repositoy on my local machine. 2) I created a Jenkins Freestyle job and on the configure screen entered the following parameters:
Repository URL: [email protected]:/home/media/git_repo_remote Credentials: none
The following error appears under the "Repository URL" text field:
Failed to connect to repository : Command "git ls-remote -h [email protected]:/home/media/git_repo_remote HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I then changed the repository URL to "https:///127.0.0.1/home/media/git_repo_remote" and receive the following in the log:
Started by an SCM change
Building in workspace /var/lib/jenkins/workspace/First Job
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https:///127.0.0.1/home/media/git_repo_remote # timeout=10
Fetching upstream changes from https:///127.0.0.1/home/media/git_repo_remote
> git --version # timeout=10
> git fetch --tags --progress https:///127.0.0.1/home/media/git_repo_remote +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
> git rev-parse origin/master^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Any help would be greatly appreciated.
Thanks
So I have 3 suggestions:
Regarding "https:///127.0.0.1/home/media/git_repo_remote" as git remote url - are you sure you have http server configured properly? Did you try opening this address in any browser on jenkins machine (or agent on which jenkins is executing its jobs) ?
Reegarding "[email protected]:/home/media/git_repo_remote" as git remote - as @LethalProgramme mentioned the problem is that host verification key for localhost on jenkins machine (agent) is incorrect. So in some moment of time SSH host verification key for your jenkins machine has changed. What you can do is to ssh to that machine and execute: ssh-keygen -R 127.0.0.1
or ssh-keygen -R localhost
as the same user as jenkins. See this question and it's answers for more details.
I believe the easiest solution would be to use git local protocol intead of ssh or https. So set up you remote url to: /home/media/git_repo_remote
or file:///home/media/git_repo_remote
Please check your branch where repositories hosted either main or Master
if repositories hosted in main , then Branches to build to */main if repositories hosted in master,then Branches to build to */master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With