当我尝试将 spring cloud config 连接到 bitbucket 存储库时出现以下错误。
.c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.
org.eclipse.jgit.api.errors.TransportException: git@bitbucket.org:myapp/configurations.git: failed to send channel request
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:224) ~[org.eclipse.jgit-5.12.0.202106070339-r.jar:5.12.0.202106070339-r]
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:303) ~[org.eclipse.jgit-5.12.0.202106070339-r.jar:5.12.0.202106070339-r]
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:178) ~[org.eclipse.jgit-5.12.0.202106070339-r.jar:5.12.0.202106070339-r]
Caused by: com.jcraft.jsch.JSchException: failed to send channel request
at com.jcraft.jsch.Request.write(Request.java:65) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.RequestEnv.request(RequestEnv.java:52) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelSession.sendRequests(ChannelSession.java:222) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelExec.start(ChannelExec.java:41) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.Channel.connect(Channel.java:152) ~[jsch-0.1.55.jar:na]
at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:159) ~[org.eclipse.jgit.ssh.
我不知道消息是什么意思 channel 请求。这些是我的 yml 设置
spring:
cloud:
config:
server:
git:
uri: git@bitbucket.org:myapp/configurations.git
default-label: main
clone-on-start: true
ignore-local-ssh-settings: true
privateKey : |
-----BEGIN RSA PRIVATE KEY-----
**************************************
**************************************
-----END RSA PRIVATE KEY-----
我需要在 yml 文件中为 channel 设置一些东西吗
最佳答案
在Spring Cloud Config 3.1.0(Spring Cloud 2021.0.0)中出现同样的错误。看起来它与 git protocol version switch 有关从 5.11 版本开始在 JGit 中从 V1 到 V2
在客户端将 git 协议(protocol)版本切换回 V1 解决了这个问题。您可以通过在 JGit 配置文件中添加以下行来完成($HOME/.config/jgit)
[protocol]
version = 1
或者你可以更新全局 git 协议(protocol)版本
git config --global protocol.version 1
关于bitbucket - 克隆到基本目录 git@bitbucket.org :myapp/configurations. git 发送 channel 请求失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70311526/