Hi everyone!

According to the GitLab documentation you can read repositories with a private access token. See link: https://docs.gitlab.com/ee/api/README.html#personalproject-access-tokens

The current version and prior version of Spring Cloud Config Server seem not to support this feature.

Environment

Component       Version
Spring Boot     2.4.0
Spring Cloud    2020.0.0-M5
GitLab CE       13.5.3
Java VM         openjdk 11

What I have tried so far I have created a private access token on the GitLab server and tried to configure it inside the spring cloud config server. 1. When I add the ?private-token= parameter, the server won't start because JGit seems to append a path to the configured uri which leads to an invalid url. Caused by: org.apache.http.client.CircularRedirectException: Circular redirect to 'https://gitlab.home.local/spring-cloud-config.git?private_token=<token>/info/refs&service=git-upload-pack' 2. I have tried to add the token as a header field in the application.properties. But the property seems to be ignored or at least not evaluated at this point. spring.cloud.config.headers.PRIVATE-TOKEN=<token> or spring.cloud.config.headers.Authorization=Bearer <token>

Best regards, David

Comment From: spencergibb

That header is for config client talking to config server. We would need something equivalent for git in general (not specific to any git hosting service).

Comment From: david-9000

A new parameter like spring.cloud.config.server.git.headers.*? Or via spring.cloud.config.server.git.preferred-authentications? I am looking still for a document specifiying possible values for this parameter. A dedicated preferred authentication type like "token" or similar and a corresponding parameter to provide the token could do the trick.

Comment From: mzeitlin

This workaround seemed to work for me based on some JGit documentation:

spring:
  cloud:
    config:
      server:
        git:
          uri: https://<token-name>:<token>@<repo_url>
          username: <username>
          password: <token>

Comment From: nphatan

you can try like this https://usernameofgit:personalaccesstoken@github.com/repo_nameorurl