Spring Cloud 配置服务器 - Git - 未授权

Ald*_*lva 5 bitbucket spring-boot spring-cloud-config

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

应用程序.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}'
Run Code Online (Sandbox Code Playgroud)

当我尝试访问该 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]

Run Code Online (Sandbox Code Playgroud)

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

hen*_*eor 6

我必须在我的 Github 用户设置上生成个人访问令牌。并使用它来代替真实的密码。

在此输入图像描述

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


小智 0

从 GitHub 设置中的开发人员设置生成令牌(经典)。使用它作为密码就可以了