从托管在 GitHub 上的 Spring Cloud Config Server 访问的 repo 存在身份验证问题

Authentication issue with repo accessed from Spring Cloud Config Server hosted on GitHub

我在 GitHub 上的存储库中托管配置。如果我保留回购 public 一切都很好,但如果我将其设为私有,我将面临:

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

我用来定位回购的 属性 是

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

我应该如何使用私人仓库正确配置它,谢谢

您需要添加

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

而且事情应该适合你

 - SPRING_CLOUD_CONFIG_SERVER_GIT_USERNAME=XXXXX
  - SPRING_CLOUD_CONFIG_SERVER_GIT_PASSWORD=XXXXXXXXXXXX
  - SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT-LABEL=branchXXXXX

我是运行这个docker,它对我有用

对于初学者来说,我是这样使用 spring 云服务器作为 docker 容器的

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"

~