spring - 使用私有 git 存储库配置服务器
问题描述
我想在我的配置服务器上使用私有 git 存储库。这是我的application.yml
:
server:
port: 100
spring:
application:
name: smth-config-server
cloud:
config:
server:
git:
uri: https://github.com/smth/smth
default-label: main
username: smth
password: smth
host-key-algorithm: ssh-rsa
ignore-local-ssh-settings: true
host-key: ssh-rsa smth== github.com
private-key: -----BEGIN RSA PRIVATE KEY-----
smth
-----END RSA PRIVATE KEY-----
我收到以下错误:
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/smth/smth: not authorized
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:544)
我应该如何解决它?
解决方案
要使用私有存储库,您必须在密码属性上使用 git 访问令牌(您可以按照此步骤生成)。
所以例如
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: yourgithubrepo
username: ${GIT_USER}
password: pasteyouraccesstoken
default-label: "main"
那应该工作
推荐阅读
- javascript - 如何使用 express/node.js 中的 POST 从 URL 编码的表单中检索数据/键:值对?
- overriding - Drupal 8:如何在我的客户主题中覆盖模块文件
- ruby - 无法在窗口 10 上使用 ubuntu 的 bash 通过 rbenv 安装 ruby
- javascript - 按钮 onclick 事件无法正常工作
- sparql - 使用 SPARQL 读取本地数据集
- javascript - 选择 Materialize.css 自动完成以将所选值传递给另一个函数时如何运行函数?
- javascript - 将函数作为对象的值传递
- excel - Excel VBA运行时错误450直接引用范围而不是通过中间变量
- linux - 用于在 x86 SMP 中启动 FS 的工作 linux 内核 + gem5 配置
- html - 是否可以收听 ':host'-Pseudo-Selector?