18

I'm hosting a configuration in a repo on GitHub. If I keep the repo public all's good, but if I make it private I face:

org.eclipse.jgit.errors.TransportException: 
 https://github.com/my-user/my-repo:
 Authentication is required but no CredentialsProvider has been registered

the property I use to target the repo is

spring.cloud.config.server.git.uri=https://github.com/my-user/my-repo

What should I do to configure this properly with the private repo, thanks

Sathiamoorthy
  • 8,831
  • 9
  • 65
  • 77
learnAndImprove
  • 1,339
  • 4
  • 15
  • 25

4 Answers4

27

you need to add the

spring.cloud.config.server.git.username=your_github_username
spring.cloud.config.server.git.password=your_github_password

and things should workout for you

Master Slave
  • 27,771
  • 4
  • 57
  • 55
1
 - SPRING_CLOUD_CONFIG_SERVER_GIT_USERNAME=XXXXX
  - SPRING_CLOUD_CONFIG_SERVER_GIT_PASSWORD=XXXXXXXXXXXX
  - SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT-LABEL=branchXXXXX

I am running this as docker, and it worked for me

for the starter's this how I am using spring cloud server as docker container

container_name: sccserver
ports:
  - 8080:8080
volumes:
  - /data/config-dir:/data
environment:
  - EUREKA_HOST=$DOCKERHOST
  - scc_search_paths={application}, {application}/extended-attributes, {application}/feature-flags, {application}/properties, {application}/error-codes,{application}/seed-data,{application}/globalization,{application}/json-validator-schema,{application}/seedData
  - VIRTUAL_HOST=$DOCKERHOST
  - MESSAGING_HOST=$DOCKERHOST
  - SCC_GIT_URI=https://bitbucket.com/XXXXXXX.git 
  - "JAVA_OPTS=-Xmx512m"
  - SCC_GIT_SKIPSSLVALIDATION=true
  - SPRING_CLOUD_CONFIG_SERVER_GIT_USERNAME=
  - SPRING_CLOUD_CONFIG_SERVER_GIT_PASSWORD=
  - SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT-LABEL=
extra_hosts:
  - "dockerhost:$DOCKERHOST"

~

harsha k
  • 81
  • 1
  • 2
1

Master Slave solution works but add the token instead of the github password.

spring.cloud.config.server.git.username=<your_github_username>
spring.cloud.config.server.git.password=<your_github_token>

Token Generation Steps:

  1. Go to settings.
  2. Then Developer Settings
  3. Generate the token here.
Sathiamoorthy
  • 8,831
  • 9
  • 65
  • 77
0

I found the same problem, we were working on a private project. So I do not find very secure to provide my github username and password so :

I made repository -> public. So it worked for me.

Ibrahim Kelly
  • 548
  • 1
  • 4
  • 9