【发布时间】:2020-07-23 11:37:35
【问题描述】:
Spring Cloud 配置框架:
我正在尝试将 java 项目中的 spring 云配置与后端存储库 git 集成,后者是 bitbucket。基本上,我在不同的场合会更频繁地遇到两个错误。
2020-04-11 17:08:59.265 WARN 2792 --- [ main] .c.s.e.MultipleJGitEnvironmentRepository : Could not fetch remote for master remote: https://user@bitbucket.org/workspace/config-repo.git
以上情况,使用缓存版本,tomcat/undertow服务器启动没有任何问题。
2020-04-11 17:09:03.774 INFO 2792 --- [ main] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/api-gateway.yml
2020-04-11 17:09:03.774 INFO 2792 --- [ main] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/discovery-service.yml
2020-04-11 17:09:03.775 INFO 2792 --- [ main] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/config-service.yml
Git 版本:
git version 2.24.0
错误 1:git-upload-pack
2020-04-11 00:00:20 - WARN 克隆到基目录时出错。
org.eclipse.jgit.api.errors.TransportException: https://<username>@bitbucket.org/<workspace>/config-repo.git: git-upload-pack not permitted on 'https://beatles89@bitbucket.org/workspace/config-repo.git/'
启动spring cloud config server,我随机收到这个错误。在深入研究了这个问题后,我发现 git-upload-pack 在 bitbucket 上不受支持。但是2年前被here举报,建议恢复GIT版本。
错误 2:不支持身份验证
org.eclipse.jgit.api.errors.TransportException: https://bitbucket.org/user/repo.git: authentication not supported
当我点击执行器上的/refresh 以从远程配置存储库中获取刷新的属性时,我得到了上述错误。有时它可以正常工作,有时它会抛出上述错误。
curl localhost:8060/refresh -d {} -H "Content-Type: application/json"
执行器刷新命令错误:
{"timestamp":"2020-04-10T16:35:41.144+0000","status":500,"error":"Internal Server Error","message":"Request processing failed; nested exception is org.springframework.cloud.config.server.environment.NoSuchRepositoryException: Cannot clone or checkout repository: https://beatles89@bitbucket.org/augmentedcloud/ac-config-repo.git","path":"/refresh"}
注意:附带说明,我已经单独克隆了指定的存储库以进行测试,它可以正常工作,没有任何身份验证问题。
【问题讨论】:
-
您告诉您使用的是 git-core(命令行 Git)2.24.0,但错误消息显示 JGit,它是 Java 中的 Git 实现,是 git-core 的替代品。您能否澄清一下您正在使用什么,为什么用 [eclipse] 标记您的问题以及重现该问题需要哪些步骤?
-
@howlger - 我已经提到尝试创建 spring 云配置服务项目。 Spring cloud config 支持从不同的存储库(例如基于文件的系统、git 等)获取属性或配置。我选择了 GIT 作为后端存储库。现在 Spring Cloud 配置框架在内部使用 JGIT 库 org.eclipse.jgit.api 进行 GIT 操作。这就是为什么我标记了这个问题的所有相关方。
-
@howlger - 没有说我在使用终端或任何其他软件的 Git 上遇到了这个问题。这个问题的原始来源是 Spring Cloud Config 框架、Bitbucket 和 JGIT。它发生得如此频繁,以至于我什至无法启动我的 tomcat/undertow servlet 服务器。为了更清楚起见,我将更新原始帖子。
-
所以你从使用 JGit 的 Spring Cloud Config Server 收到这些错误消息;根本不涉及 Git 2.24.0(至少不在你这边;也许在远程上游存储库那边),对吧?
-
@howlger - 不涉及核心 Git (2.24.0)。但是 JGit (org.eclipse.jgit.api.errors.TransportException) 可能会。我提到了 Core Git,因为其他人报告了同样的问题,并且修复已恢复到核心 GIT 的早期版本。对我来说,核心 Git 在 mac 终端上运行良好。
标签: git eclipse bitbucket jgit spring-cloud-config-server