Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job

Tags:

git

jenkins

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

like image 644
TheShwiftmeister Avatar asked Jun 14 '17 20:06

TheShwiftmeister


2 Answers

So I have 3 suggestions:

  1. 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) ?

  2. 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.

  3. 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

like image 57
running.t Avatar answered Nov 15 '22 05:11

running.t


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

like image 29
Rathinam Shanmugam Avatar answered Nov 15 '22 05:11

Rathinam Shanmugam