spring cloud配置服务器无法连接到私有git仓库(未授权)

ghhaqwfi  于 2023-02-08  发布在  Spring
关注(0)|答案(1)|浏览(305)

我想在我的配置服务器上使用私有的git仓库。这里是我的www.example.comapplication.properties:

spring.application.name=PhotoAppApiConfigServer
server.port=8012
spring.cloud.config.server.git.uri=https://github.com/nasrouu/PhotoAppConfiguration.git
spring.cloud.config.server.git.username=myusername
spring.cloud.config.server.git.password=mypassword

spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.default-label=main

management.endpoints.web.exposure.include=busrefresh

spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest

出现以下错误:

Error occured cloning to base directory

org.eclipse.jgit.api.errors.TransportException:
https://github.com/nasrouu/PhotoAppConfiguration.git: not authorized

application.properties for my private github repositorie

gateway.ip=192.168.2.82
token.expiration_time=864000000
token.secret=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpZCI6IjVjOWYzYW
I2NzY2Mjg2NDYyNDY0YTczNCIsIm5hbWUiOiJSYW5keSIsImF2YXRhciI6I
i8vd3d3LmdyYXZhdGFyLmNvbS9hdmF0YXIvMTNhN2MyYzdkOGVk 
NTNkMDc2MzRkOGNlZWVkZjM0NTEcz0yMDAmcj1wZyZkPW1tIiwi
aWF0IjoxNTU0NTIxNjk1LCJleHAiOjE1NTQ1MjUyOTV9SxRurShXSSI3SE11z6nme9EoaD2
9TDBFr8Qwngkg
login.url.path=/users/login

我该怎么修呢?

njthzxwz

njthzxwz1#

你必须创建一个个人访问标记https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
然后将生成的标记作为del key复制到配置文件aplicación. propiedes中。例如:

spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.uri=https://github.com/joselizagaravito/RepositoryDemo
spring.cloud.config.server.git.username=myusername
spring.cloud.config.server.git.password=ghp_8ArBnIhaRUD4omMscbwOMydb4445556663

相关问题