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: 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.
These are my yml settings
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-----
I have no idea what the error means.
Comment From: ryanjbaxter
There is not really much in the info you gave for us to say what might be wrong. If you can give us a way to reproduce the problem we can try to help.
Comment From: AnthonyCavanagh
Ok I have changed the code slightly. Looking at the docs and the examples. It seems that to connect spring cloud config to bitbucket. You either have to include a user name and password, which will give access to the whole of the repository. Or use ssh key with a public key and a private key set up in the application properties or yml file.
I would rather not do either. In BitBucket you can create a Access Key in Repository settings. What I would like to do is use that key to access that repository. So in my yml file I have the following. I want to connect to the repo uri: git@bitbucket.org:myproject/configurations.git, on branch dev,
Now in my bit bucket I have a Access Key config-key and the key is "ssh-rsa xxxxxxxxxxxxxxxxxxxxxxx== myemail@.com"
spring: cloud: config: server: git: uri: git@bitbucket.org:myproject/configurations.git clone-on-start: true default-label: dev hostKey: config-key
But I get the exception reject HostKey. Is the HostKey access Key, and do you give it the label or do you have to put the full key
`spring: cloud: config: server: git: uri: git@bitbucket.org:myproject/configurations.git clone-on-start: true default-label: dev hostKey: "ssh-rsa xxxxxxxxxxxxxxxxxxxxxxx== myemail@.com"
All the examples expect that you are either going to include a password and username or a private key. I just want to go for the simplest neatest solution using the Access Key to just access the one repository
Comment From: AnthonyCavanagh
This is application,yml I created it uses a passphrase a private key, that matches a public rsh key I created , that I put into a BitBucket repository settings. I followed a how to do to the letter and I am getting a 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]
Comment From: AnthonyCavanagh
All I want is something that works that does not need a pass word and a username. Thanks
Comment From: ryanjbaxter
Duplicate of https://github.com/spring-cloud/spring-cloud-config/issues/2014