bitbucket - 克隆到基本目录 git@bitbucket.org :myapp/configurations. git 发送 channel 请求失败

标签 bitbucket spring-cloud-config jgit

当我尝试将 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/

相关文章:

git - 使用 JGit 以编程方式获取所有 Git 分支

git - 我在 git 中提交并只更改了一个文件并插入了一个文件

python-3.x - 使用 Python 解压从 JSON 获得的字典

git - 从 git 存储库中拆分一个子文件夹,其中包含所有分支和历史记录

java - 是否可以使用 Spring Cloud Config 将复杂的配置传递给 Spring Cloud Stream 函数

java - 解决对docker-compose的依赖

当推送不可能时,JGit 推送不会失败

java - JGit:在分支中的提交处读取文件的内容

git - 如何在 TeamCity 中使用动态参数?

git - 为所有用户关闭分支上的 git fastforward