【问题标题】:Spring Cloud Config Server - Git - Not authorizedSpring Cloud Config Server - Git - 未授权
【发布时间】:2021-05-25 00:06:16
【问题描述】:

我有一个使用 Spring Cloud Config 的 Spring-Boot 应用程序,我正在尝试从 Bitbucket 获取应用程序的配置文件。前段时间我能够获取配置文件,但现在当我尝试通过 config-server url 访问时出现错误。

application.yml:

server:
    port: 8888
spring:
    application:
        name: config-server
    cloud:
        config:
            server:
                git:
                    password: ##########
                    username: ##########
                    uri: https://USERNAME@bitbucket.org/repositorios-closeup/cup-configuration-files
                    searchPaths: '{application}'

当我尝试访问 url 时,应用程序显示错误 - 未授权

org.eclipse.jgit.api.errors.TransportException: https://USERNAME@bitbucket.org/repositorios-closeup/cup-configuration-files: not authorized

    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:254) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
    at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]

有人知道发生了什么吗?我已经检查了 bitbucket 上的所有凭据和 url。

【问题讨论】:

    标签: spring-boot bitbucket spring-cloud-config


    【解决方案1】:

    我把用户名和密码颠倒了:(。

    【讨论】:

      【解决方案2】:

      我添加了以下命令行。它对我有用。

      spring.cloud.config.server.git.ignore-local-ssh-settings=true
      

      此设置忽略本地 ssh 配置。

      【讨论】:

        【解决方案3】:

        我必须在我的 Github 用户设置中生成个人访问令牌。并使用它,而不是真正的密码。

        我知道你提到了 Bitbucket,但我在 Github 上遇到了同样的问题。这就是我解决“未授权”消息的方法。

        【讨论】:

          猜你喜欢
          • 2016-07-06
          • 2020-07-02
          • 1970-01-01
          • 2020-04-22
          • 2023-01-27
          • 1970-01-01
          • 1970-01-01
          • 2019-08-09
          • 1970-01-01
          相关资源
          最近更新 更多