How to ignore .ssh/config? [message #1777615] |
Thu, 30 November 2017 14:05  |
Eclipse User |
|
|
|
I'm trying to write some automated tests that wrap around ssh authentication that I've otherwise got successfully working.
I'm using the approach described here:
http://www.codeaffine.com/2014/12/09/jgit-authentication/
where I'm subclassing JSchConfigSessionFactory, and overriding the configure method. I'm also overriding the createDefaultJSch method so I can supply public/private keys that I've created specifically for the automated test. This all works great.
The problem I'm having is that when I run my tests, the SSH connection attempt still tries keys specified in my .ssh/config. I don't want it to do this, since that means the tests will run differently for different developers depending on their own personal .ssh/config files. I want it to completely ignore that file for purposes of the test.
I've tried doing
defaultJSch.removeAllIdentity()
... but this doesn't seem to help. Strangely, when I use defaultJSch.getIdentityNames, it only shows the keys I have configured; but when I actually use the JGit API to try to do something requiring a connection, the .ssh/config settings seem to be invoked. When I enable JSch detailed debugging logging, I can see that it's trying to connect via a key specified in my .ssh/config.
It's possible I'm doing something wrong and don't know it, but I wanted to check here first to see if there's a clear-cut and simple way to tell JSchConfigSessionFactory to completely avoid the .ssh/config file.
Thanks!
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05444 seconds