hoonii2

[Jenkins] Jenkins to Github Repo ssh 최초 시도 오류 본문

개념 공부/(인프라) 04. 컨테이너

[Jenkins] Jenkins to Github Repo ssh 최초 시도 오류

hoonii2 2023. 2. 9. 02:13

1. 상태

Jenkins 에서 Github Project 를 ssh 방식 (RSA) 으로 접근하기 위해 설정 중

Github 에는 공개키, Jenkins Credentials 에는 개인키를 올바르게 넣었으나

이런 host key verification failed 오류가 발생하는 것을 확인했다.

 

 

 

 

2. 해결 방안

Jenkins Container 에서 Github Repo 에 한 번 ssh 접속해서 known_hosts 에 등록

( git ls-remote -h git@~~~.git HEAD )
( 꼭 'yes' 로 ssh 접근을 계속 해준다 )

user@Docker:/home/jenkins$ docker exec -it jenkins-docker /bin/bash

root@fc2a9635f16e:/#
root@fc2a9635f16e:/# git ls-remote -h git@github.com:hoonii2/CI_CD.git HEAD
The authenticity of host 'github.com (20.200.245.247)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,20.200.245.247' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
root@fc2a9635f16e:/#

 

3. 해결

이후 오류메시지 없이 ssh 접속 성공 확인

 

 

4. 출처

https://stackoverflow.com/questions/15174194/jenkins-host-key-verification-failed

 

Jenkins Host key verification failed

I have a problem with jenkins, setting "git", shows the following error: Failed to connect to repository : Command "git ls-remote -h https://person@bitbucket.org/person/projectmarket.git HEAD" ret...

stackoverflow.com

 

Comments