gitspring-bootspring-cloud-config-server

Spring Cloud Config - git-upload-pack not permitted


I have a spring-boot application running on docker environment that connect on Git repository to get application's configuration. My problem is from time to time the application gives an error when try to get the .properties file. It's strange because the same application if I change the user and password come back to work.

Error

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]

I've tried this solution but it didn't work: 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: "*"

I've already check inside docker container if temp directory has all permissions.

When I run the same application on my local environment with mvn spring-boot:run command it works.

PS: Git version locally is different from docker environment. I don't know if could be the problem.


Solution

  • I've created a cup-configuration-files directory, initialized it with git and made a git pull to get all the files and on application.yml I put the uri as file:

    application.yml:

    server:
        port: 8888
    spring:
        application:
            name: config-server
        cloud:
            config:
                server:
                    git:  
                        basedir: temp
                        password: ######
                        username: ######
                        uri: file:/cup-configuration-files
                        searchPaths: '{application}'
    management:
            endpoints:
              web:
                exposure:
                  include: "*"