2016-10-10 7 views
2

ssh 키를 사용하여 private bitbucket git 저장소와 함께 tutorial 다음에 Spring Cloud Config를 구성하려는 Linux (arch)에 있지만 오류가 계속 발생합니다 :스프링 클라우드 구성이 ssh 키를 사용하여 전용 bitbucket 저장소를 복제 할 수 없음

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception 
[Request processing failed; nested exception is java.lang.IllegalStateException: Cannot 
clone or checkout repository] with root cause com.jcraft.jsch.JSchException: Auth fail 

이제 튜토리얼에 따라 작동해야합니다

If you don’t use HTTPS and user credentials, SSH should also work out of the box when you store keys in the default directories (~/.ssh) and the uri points to an SSH location, e.g. "[email protected]:configuration/cloud-configuration". It is important that all keys in ~/.ssh/known_hosts are in "ssh-rsa" format. The new "ecdsa-sha2-nistp256" format is NOT supported. The repository is accessed using JGit, so any documentation you find on that should be applicable. HTTPS proxy settings can be set in ~/.git/config or in the same way as for any other JVM process via system properties (-Dhttps.proxyHost and -Dhttps.proxyPort).

을 나는 ~/스푸핑라는 이름의 폴더의 bitbucket-RSA에서 개인 SSH 키가 수행 명령 ssh-keygen -t rsa -b 4096 -C "[email protected]"을 사용하여 만들었습니다. 공개 키는 Bitbucket에 올바르게 추가되었으므로 커맨드 라인에서 저장소를 복제하고 끌어 당길 수 있습니다. 개인 키는 ssh-agent에 추가되었으며 bitbucket.org는 known_hosts 파일에 있습니다.

는 여기에는 config 서비스 프로젝트 bootstrap.yml의 : 사용자 이름과 암호 작품 HTTPS를 사용하여

spring: 
    application: 
    name: config-service 
    cloud: 
    config: 
     server: 
     git: 
      uri: "[email protected]:TarekSaid/my-private-repo.git" 
server: 
    port: 8888 

,하지만, 난 여전히 나는 그것이 작동하는 방법을 만들 수 있습니다 SSH 키를 사용하여 선호?

답변

6

마침내 제작되었습니다.

이 질문 : How to use a custom ssh key location with Spring Cloud Config이 올바른 방향으로 나를 가리켰습니다. JschConfigSessionFactory 클래스를 디버깅하고 사용자 이름과 암호를 제공하지 않으면 기본 구성 파일에서 구성을 ~/.ssh/config으로 가져옵니다.

Host bitbucket.org 
    User TarekSaid 
    Hostname bitbucket.org 
    PreferredAuthentications publickey 
    IdentitiesOnly yes 
    IdentityFile ~/.ssh/bitbucket_rsa 

가 지금은 일하고

~/스푸핑/구성 :

따라서 내가했던 일은, 나의 ~/스푸핑/설정 파일에 다음을 추가했다.