2

I see issues in the Spring cloud config server (Springboot) logs when connecting to the repo where configs are stored. I'm not sure if it's unable to clone because of credentials or something else (git-upload-pack not permitted). Any pointers to this would be great.

2021-10-06 22:52:51.763  INFO 1 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-10-06 22:52:51.764  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-10-06 22:52:51.765  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
2021-10-06 22:52:54.769  WARN 1 --- [nio-8080-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.

org.eclipse.jgit.api.errors.TransportException: https://github.asdf.asdf.asdf.com/asdfad/sdasdf: git-upload-pack not permitted on 'https://github.asdf.asdf.adsf.com/sdfdf/asdfsad-configs/'
    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]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:612) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:587) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:570) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh(JGitEnvironmentRepository.java:267) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.getLocations(JGitEnvironmentRepository.java:245) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]
    at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.getLocations(MultipleJGitEnvironmentRepository.java:139) [spring-cloud-config-server-3.0.4.jar!/:3.0.4]

The Spring boot app.properties for the config server app looks like this -

spring.cloud.config.server.git.uri=https://github.sdf.sdasdf.asdf.com/asdf/asdf-configs
          spring.cloud.config.server.git.username=github-token
          spring.cloud.config.server.git.password={github_token}

The endpoint returns the response below:

{"status":"DOWN","components":{"clientConfigServer":{"status":"UNKNOWN","details":{"error":"no property sources located"}},"configServer":{"status":"DOWN","details":{"repository":{"application":"app","profiles":"default"},"error":"org.springframework.cloud.config.server.environment.NoSuchRepositoryException: Cannot clone or checkout repository: https://github-token@github.sdf.sdf.dsfs.com/sdf/sdfsd-configs"}},"discoveryComposite":{"description":"Discovery Client not initialized","status":"UNKNOWN","components":{"discoveryClient":{"description":"Discovery Client not initialized","status":"UNKNOWN"}}},"diskSpace":{"status":"UP","details":{"total":103880232960,"free":24558080000,"threshold":10485760,"exists":true}},"livenessState":{"status":"UP"},"ping":{"status":"UP"},"readinessState":{"status":"UP"},"refreshScope":{"status":"UP"}},"groups":["liveness","readiness"]}
Avi
  • 1,453
  • 4
  • 18
  • 43
  • I can confirm the credentials are right but spring cloud config server is still unable to clone the configs repo and throws the exception above. – Avi Oct 07 '21 at 21:37
  • While I don't know the reason for this issue (never encountered this one), I can see that somebody asked for the same here https://stackoverflow.com/questions/68058710/spring-cloud-config-git-upload-pack-not-permitted and suggested that change of username and password helped for a while. Have you tried this solution? Maybe it would definitely fix the issue? – Pawel Woroniecki Oct 07 '21 at 23:23
  • Have you tried it with other type of git server like gitlab.com or bitbucket? – Dániel Kis Oct 27 '21 at 12:15

3 Answers3

5

Github token needs to be passed as username which I was configuring against the password property for the spring boot app. The password property needs to be left empty and the Github-token needs to be assigned to the username like below-

spring.cloud.config.server.git.username=asdfasdxxxxxxxyssssysysyssysy
spring.cloud.config.server.git.password=
Raphael
  • 517
  • 4
  • 18
Avi
  • 1,453
  • 4
  • 18
  • 43
1

Token authentication requirements are necesary for Git operations, see this link for more info.: https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

NeilSehgel
  • 11
  • 1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30646983) – João Dias Dec 22 '21 at 22:17
-1

Try to add .git in the end of the URI in app.properties

spring.cloud.config.server.git.uri=https://github.sdf.sdasdf.asdf.com/asdf/asdf-configs.git
Norgod64
  • 1
  • 1