Reputation: 115
I want to use private git repository with my config server. Here is my 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-----
I get the following error:
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/smth/smth: not authorized
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:544)
How should I fix it?
Upvotes: 5
Views: 4915
Reputation: 11
In your config server application properties:
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}
Upvotes: 1
Reputation: 815
For this to work with a private repository you must use a git access token (which you can generate following this steps) on your password property.
so for example
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: yourgithubrepo
username: ${GIT_USER}
password: pasteyouraccesstoken
default-label: "main"
that should work
Upvotes: 3