我有一个简单的Spring Config Server应用程序,它使用GIT存储库中的配置数据 . 此Config Server在我的本地和开发环境中按预期完美运行 . 一旦部署到 生产环境 服务器,我一直看到这个错误:org.springframework.cloud.config.server.environment.NoSuchLabelException:没有这样的标签:master

这是整个JSON返回:

{
  "status": "DOWN",
  "configServer": {
    "status": "DOWN",
    "repository": {
      "application": "app",
      "profiles": "default"
    },
    "error": "org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: master"
  },
  "discoveryComposite": {
    "description": "Discovery Client not initialized",
    "status": "UNKNOWN",
    "discoveryClient": {
      "description": "Discovery Client not initialized",
      "status": "UNKNOWN"
    }
  },
  "diskSpace": {
    "status": "UP",
    "total": 10434699264,
    "free": 6599856128,
    "threshold": 10485760
  },
  "refreshScope": {
    "status": "UP"
  },
  "hystrix": {
    "status": "UP"
  }
}

所以我将它追溯到spring-cloud-config GitHub repo,并看到它被抛出:https://github.com/spring-cloud/spring-cloud-config/blob/b7afa2bb641913b89e32ae258bd6ec442080b9e6/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java#185这个错误是由GitCommand类抛出的's call() method on line 235 when a Git branch is not found. But I can' t为我的生活理解为什么!!!我已经仔细检查并验证了"master"分支确实存在于GIT存储库中以获取配置属性 .

Config Server的应用程序属性在bootstrap.yml文件中定义,如下所示:

server:
  port: 8080

management:
  context-path: /admin

endpoints:
  enabled:  false
  health:
    enabled: true

logging:
  level:
    com.netflix.discovery: 'OFF'
    org.springframework.cloud: 'DEBUG'

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    statusPageUrlPath: /admin/info
    healthCheckUrlPath: /admin/health

spring:
  application:
    name: config-service
  cloud:
    config:
      enabled: false
      failFast: true
      server:
        git:
          uri: 'https://some-spring-config-repo.git'
          username: 'fakeuser'
          password: 'fakepass'
          basedir: "${catalina.home}/target/config"`

非常感激任何的帮助!!