配置私有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"  

应该可以工作

在配置服务器应用程序属性中:

profiles:
active: git

spring:
cloud:
config:
server:
git:
uri: https://github.com/${GIT_USER}/${GIT_REPO}.git
username: ${GIT_USER}
password: pasteyouraccesstoken
clone-on-start: true
default-label: ${GIT_BRANCH}
searchPaths: ${FOLDER_PATH}

相关内容

  • 没有找到相关文章

最新更新