【发布时间】:2021-09-04 13:57:09
【问题描述】:
我有一个在 docker 环境上运行的 spring-boot 应用程序,它连接到 Git 存储库以获取应用程序的配置。我的问题是应用程序在尝试获取 .properties 文件时有时会出错。这很奇怪,因为如果我更改了用户和密码,相同的应用程序会重新工作。
错误
2021-06-20 15:42:57.229 WARN 1 --- [nio-8888-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.
org.eclipse.jgit.api.errors.TransportException: https://####@bitbucket.org/####/cup-configuration-files: git-upload-pack not permitted on 'https://####@bitbucket.org/####/cup-configuration-files/'
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:254) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
我已经尝试过这个解决方案,但它不起作用:create basedir directory。
application.yml
server:
port: 8888
spring:
application:
name: config-server
cloud:
config:
server:
git:
basedir: temp
password: ####
username: ####
uri: https://#######@bitbucket.org/########/cup-configuration-files
searchPaths: '{application}'
management:
endpoints:
web:
exposure:
include: "*"
如果临时目录拥有所有权限,我已经检查了 docker 容器内部。
当我使用 mvn spring-boot:run 命令在本地环境中运行相同的应用程序时,它可以工作。
PS:本地 Git 版本与 docker 环境不同。不知道会不会有问题。
【问题讨论】:
-
找到解决方案了吗?
-
我创建了一个本地目录并将所有内容从 bitbucket 复制到该目录并在 application.yml 上进行设置
-
谢谢。刚才我修好了。使用我的同事 bitbucket 帐户。它不适用于我的帐户。
-
一两天你就需要换了,我也做了这个攻略。
-
好的,谢谢。如果发生这种情况,我会更改并在 cmets 中通知您
标签: git spring-boot spring-cloud-config-server