Git 身份验证失败 Spring 云配置存储

Git Authentication Failure Spring Cloud config store

我们正在配置 spring 云配置服务器,下面是我的应用程序属性的外观:

server.port=8080
spring.cloud.config.server.git.uri=https://github.com/myorganization/config-store.git
spring.cloud.config.server.git.searchPaths={application}
spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.skipSslValidation=true
spring.cloud.config.server.git.ignore-local-ssh-settings=true
spring.cloud.config.server.git.username=MyUser
spring.cloud.config.server.git.password=MyPassword
spring.cloud.config.server.git.default-label=develop
spring.application.name=config-server
spring.security.user.name=root
spring.security.user.password=password

我可以根据上述属性使用用户名 MyUser 和密码 MyPassword 登录 github url 即 https://github.com/myorganization/config-store.git 但是当我尝试使用以下命令启动我的配置服务器时: ./mvnw spring-boot:运行 我收到以下错误:

Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/myorganization/config-store.git: not authorized

我已经尝试了很多东西,但是 运行现在没有任何想法,希望能提前得到任何帮助。

使用用户名和密码对 GitHub 执行 git 操作已弃用,并且不再有效,如 here 所述。

您应该生成一个 个人访问令牌,按照 the official documentation 进行操作。然后您可以将令牌添加到 spring 配置中,因为它是您的密码:

spring.cloud.config.server.git.username=<yourusername>
spring.cloud.config.server.git.password=<yourtoken>

Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.

发件人:https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

感谢:

对于 Github Enterprise Server,我们的选择(也)有限,但被认为是安全的并且有据可查:

Authenticating with the API

You can authenticate with the API in different ways. ...

  • Personal access tokens (-> 1. , 2. ?)
  • OAuth Apps...
  • GitHub Apps...

Authenticating with the command line

...

  • HTTPS ...
  • SSH ...

SSH 时,对于 -end:

使用“本地ssh环境”或查看:https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_git_ssh_configuration_using_properties