Tony
Tony

Reputation: 473

Error occured cloning to base directory [email protected]:myapp/configurations.git failed to send channel request

I am getting the following error when I try to connect spring cloud config to a bitbucket repo.

.c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.

org.eclipse.jgit.api.errors.TransportException: [email protected]: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.

I have no idea what the message means channel request. These are my yml settings

spring:
  cloud:
    config:
      server:
        git:
          uri: [email protected]:myapp/configurations.git
          default-label: main
          clone-on-start: true
          ignore-local-ssh-settings: true
          privateKey : |
                       -----BEGIN RSA PRIVATE KEY-----
                       **************************************
                       **************************************
                       -----END RSA PRIVATE KEY-----

Do I need to set something up in the yml file for channel

Upvotes: 3

Views: 2820

Answers (3)

Goce
Goce

Reputation: 491

Got the same error in Spring Cloud Config 3.1.0 (Spring Cloud 2021.0.0). Looks like it is related to the git protocol version switch from V1 to V2 in JGit since version 5.11

Switching the git protocol version back to V1 on client side resolved the issue. You can do it by adding the following lines in the JGit configuration file ($HOME/.config/jgit)

[protocol]
    version = 1

or you can update global git protocol version with

git config --global protocol.version 1

Upvotes: 1

Ferlorin
Ferlorin

Reputation: 54

try to insert ssh:\\ at the front of your URL making it uri: ssh://[email protected]:myapp/configurations.git

Upvotes: 0

Ferlorin
Ferlorin

Reputation: 54

Check if the URI is correct. In my case it was completely wrong.

Upvotes: 0

Related Questions