使用Spring Cloud的Config Server配置如下:
spring:
cloud:
config:
server:
git:
#uri: D:\xxx\conf-test #Git-based filesystem repository(uses a file-based git repository)
uri: git@github.com:xxx/conf-test.git #use a remote git repository (such as Github)
ignore-local-ssh-settings: false #为true时必须配置privateKey
# privateKey: |
# -----BEGIN RSA PRIVATE KEY-----
# 私钥内容
# -----END RSA PRIVATE KEY-----
label: main
使用ssh-keygen -t rsa -b 4096 -C "your_email@example.com"生成的私钥是以-----BEGIN OPENSSH PRIVATE KEY-----开头,启动应用时一直报下面的错:
Reason: Property 'spring.cloud.config.server.git.privateKey' is not a valid private key
经过查看资料,需要使用ssh-keygen -m PEM -t rsa -b 4096 -C "your_email@example.com"生成的私钥,以-----BEGIN RSA PRIVATE KEY-----开头,服务启动正常