我已经创建了一个 github 存储库 https://github.com/Nisarg04/microservices-config-repo.git
,我希望将其视为配置存储库。另外,我有一个 spring 云服务器,它从本地 repo 中选择属性(根据当前配置)。我希望从 github 存储库中选择它。
application.properties
看起来像这样:
spring.application.name=spring-cloud-config-server
server.port=8888
#spring.cloud.config.server.git.uri=file:///C:/Users/admin/git/git-localconfig-repo
spring.cloud.config.server.git.uri=https://github.com/Nisarg04/microservices-config-repo.git
management.security.enabled=false
当我指向 git-localconfig-repo
时,它运行完美。但是,当我让它指向我的 repo 时,它给出了错误,因为 Cannot clone or checkout repository: https://github.com/Nisarg04/microservices-config-repo.git
我该如何解决?
编辑:也试过
spring.cloud.config.server.git.username=nisarg04
spring.cloud.config.server.git.password=我的密码
但即使是这种力量也有帮助
根据要求,我在下面添加了服务器类:
@SpringBootApplication
@EnableConfigServer
public class SpringCloudConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigServerApplication.class, args);
}
}
最佳答案
我能够重现您的问题并找到解决方案。
修复:
访问 Git 存储库时,通过在 application.properties
中添加 skip-ssl-validation=true
来跳过 SSL 验证:
spring.application.name=spring-cloud-config-server
server.port=8888
#spring.cloud.config.server.git.uri=file:///C:/Users/admin/git/git-localconfig-repo
spring.cloud.config.server.git.uri=https://github.com/Nisarg04/microservices-config-repo.git
spring.cloud.config.server.git.skip-ssl-validation=true
management.security.enabled=false
关于java - 如何将 github 存储库配置为 spring 云服务器的配置存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52646183/