2

We are configuring spring cloud config server and below is how my application properties look:

server.port=8080
spring.cloud.config.server.git.uri=https://github.com/myorganization/config-store.git
spring.cloud.config.server.git.searchPaths={application}
spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.skipSslValidation=true
spring.cloud.config.server.git.ignore-local-ssh-settings=true
spring.cloud.config.server.git.username=MyUser
spring.cloud.config.server.git.password=MyPassword
spring.cloud.config.server.git.default-label=develop
spring.application.name=config-server
spring.security.user.name=root
spring.security.user.password=password

I am able to login to the github url i.e. https://github.com/myorganization/config-store.git using the username MyUser and password MyPassword as per above properties but when i am trying to start my config server using: ./mvnw spring-boot:run i am getting the below error:

Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/myorganization/config-store.git: not authorized

i have tried out many things but running out of any ideas now, would appreciate any help in advance.

vaibhav
  • 3,929
  • 8
  • 45
  • 81

3 Answers3

3

The use of username and password to do git operations on GitHub is deprecated and it no longer works, as described here.

You should generate a Personal Access Token, follow the official documentation to do it. Then you can add the token to the spring configuration as it was you password:

spring.cloud.config.server.git.username=<yourusername>
spring.cloud.config.server.git.password=<yourtoken>
robertobatts
  • 965
  • 11
  • 22
0

Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.

From : https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

Thx to: https://stackoverflow.com/a/70443213/592355

For Github Enterprise Server, our options (also) are limited, but considered secure & well documented:

Authenticating with the API

You can authenticate with the API in different ways. ...

Authenticating with the command line

...

  • HTTPS ...
  • SSH ...

When SSH, for the -end:

Use "local ssh environment" or see: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_git_ssh_configuration_using_properties

xerx593
  • 12,237
  • 5
  • 33
  • 64
0

You can also do this using github and the new fine grained access token generated from github. In that case the username and password both must be set to the same token generated.

spring:
  application:
    name: config-service
  cloud:
    config:
      server:
        git:
          uri: https://github.com/UserName/PrivateRepo
          username: github_fine_access_token_xxxx
          password: github_fine_access_token_xxxx
         

You can also use environment variables here

Noman
  • 124
  • 2
  • 9