Search code examples
gitazure-devopsspring-cloudssh-keysspring-cloud-config

Spring cloud config using VSTS git as config-repo


I am trying to use VSTS Git as my config repo.

Here's my application.yml (sensitive information hidden or removed)

spring:
  cloud:
    config:
      server:
        git:
          uri: URL from VSTS
          ignore-local-ssh-settings: true
          host-key-algorithm: ssh-rsa
          host-key: HOST KEY FROM VSTS
          search-paths: '{application}'
          private-key: |
                        -----BEGIN RSA PRIVATE KEY-----

                       -----END RSA PRIVATE KEY-----
         passphrase: SOME PASSPHRASE

I keep getting this error:

error: org.springframework.cloud.config.server.environment.NoSuchRepositoryException: Cannot clone or checkout repository

Can anyone help me please?

EDIT-1:

  • Was able to connect to VSTS Git using HTTPS + credential
  • Configuration YAML files are on Git repo and can be fetched if using HTTPS.
  • Tried both with and without "-" on the keys. No difference.

Solution

  • After debug into spring cloud config server, the exact error is the host key is "invalid key type".

    Then I realize the hostKey and hostKeyAlgorithm were specified.

    As soon as I removed these 2 properties, VSTS Git could be connected.

    The working application.yml looks like following:

    spring: cloud: config: server: git: uri: URL from VSTS ignore-local-ssh-settings: true search-paths: '{application}' private-key: | -----BEGIN RSA PRIVATE KEY-----

    -----END RSA PRIVATE KEY-----