org.springframework.boot.context.properties.bind.BindException: 'spring.cloud.config.server.git.privateKey' 不是有效的私钥

org.springframework.boot.context.properties.bind.BindException: 'spring.cloud.config.server.git.privateKey' is not a valid private key

我在 Whosebug 上尝试了几个答案,但不知道如何让它工作


应用程序启动失败


描述:

绑定到目标 org.springframework.boot.context.properties.bind.BindException:无法将 'spring.cloud.config.server.git' 下的属性绑定到 org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties 失败:

Reason: Property 'spring.cloud.config.server.git.privateKey' is not a valid private key

操作:

更新您的应用程序配置

这是 application.properties 文件

server.port=8881
spring.cloud.config.server.git.uri=git@bitbucket.org:my_user/my_repo.git
spring.cloud.config.server.git.searchPaths=*configs
spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.ignore-local-ssh-settings=true
spring.cloud.config.server.git.passphrase=
spring.cloud.config.server.git.private-key=-----BEGIN OPENSSH PRIVATE KEY-----\n\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdzc2gtcn\
NhAAAAAwEAAQAAAYEAtl/5Hbu/bHQsddLTMI7Ph0G86/xOaq/xqs3CyQyNCCh2lzz+oeBe\
lZbG16JQ4HrhA+q9vT1xIISGS8XEf46FvbulBl473rOlOk50xTQfA5a/6CHZ2PXKq1oU2T\
PyILIB4MDWBYUDBWUBDUWNDUNWUNDUWNDUWNUDNWUBDBWWVWYXVBWB64+lhKmnyEnSaHZm\
2Jxe2RdrpTYn81WsgJKtvy7McR0eo6vGejCVTg+0aOvKw0XX5Dwy06uNwGjjWSaN0WzU7O\
Uu/Sh1gQF++lCu5IO0u/hAXzhrOcTLosNw1irNLBO9tskk/rhZ2ufgjsFZkJ0xyZGwiTD0\
v6nd+wsmf0k+KGtr8U1tf8Aw1JQ2U3+WJVxZRXmodHijuPie0b6pEpPu3xqHEvMjfKiYQt\
mH/R3tVh1FRJa88KkUt6GAU/Brh6Cczf+LLUymZb5sM0tCNJ9pWbK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6OZMQf++S5X/Q/d6NiC6F4URUGoG\
CkcQg8Q2uKEvhbaDaFkbZGyuavpeG6YC0OPWQvwaYgCzKOA4/MXSu3nRpnXUGZ0EKhAAAA\
wF5UyJZJaYSwDIsBFIkEwmzL/jLo66xcaaOl7sMQLqVIdWkT14E6dPiYXn5vexy3DaoAoZ\
2Z3xszEnLlzQ36HTrKLWyZdR9nAwQtz2q1+GpywDDao2DclAWQvQaCUuMQOK94y3ECkGIy\
DOOVhox/mlbFBONR3xF5K+Th8uq96kqi51MAqqkcdL6/zNMFIBJT+w2KoQBVe3PFn3TFfU\
eJajcOI3I6aBwgxPd2YPrSysPHIBqLnJAMfXPocW9XBb1VPgAAAMEA8EWQBzUgeevti8BZ\
8YBw2HSqZXKi+8rqrM4QxVW2EybrGSwIhzDTSwwK8vOw8HT+gcj7z8jltLqCBt/Zufihzg\
jNtoe+v9VKEuH8jd6xb1apJzR3DKyJgpBaDCCg75xIj++Qb/horE+WolcbCAjLHZo/hW+p\
nGWYd/eX3C2jCTCLmAp38lsP/HHLt0JASd5Hvg031z5fzWjMLvBOiDM2yFWozcaRsi+FZn\
qPpE5aMTyLRx+z8kA9s/Zp9Xf6SCDFAAAAwQDCUC8gfMMuWotFgFfJfjDAdfiyfAsGDRu4\
d3J3NPLyqG9YfanjvfI8ezRFRFRFRFRFRFRFFRFRBVGBGBBGBGJtDKcsJaS2Jzu/PpvVcx\
EngcryKis+GWYXTBYTWFEYBXWGYEXTGWYTGEYXGWYUEGUWGUEBWHUYXGUYGXUYBGZjyYt6\
wTOAKcfstv885VfKvGBBGBGBGBGBGBRFRFRFRFRFFDDSDWWDEDQfFtG/8lPmY8UqliKd7L\
SxX6llZwFWzCUAAAAWVmlwd.HXGUYWGUYXUYBGUYXGEUY3GBEUYXG3UYEG3UXGECAwQF\n\
-----END OPENSSH PRIVATE KEY-----

您的私钥(您不应再将其用于已公开公开的任何内容)不是 RSA 密钥,这是 Spring Cloud Config 支持的唯一密钥类型。

换句话说:只支持以-----BEGIN RSA PRIVATE KEY-----开头的私钥。

参考文档中有更多详细信息:https://cloud.spring.io/spring-cloud-config/reference/html/#_authentication