-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitSshdSessionFactory - why do I need a credentialsProvider if I've configured the SshSessionFactory? #532
Comments
I don't know why the Note that the JGit As I mentioned in the JGit issue, another idea might be to use JGit's own binding to Apache MINA sshd. |
Hi @tomaswolf I've moved to using JGit's own binding to Apache MINA sshd as suggested but have some questions on using the SshdSessionFactoryBuilder. I'm building a SshdSessionFactory where I supply a key pair programmatically (
If I pass null or omit these setters from the builder, I get a null pointer exception for both directories:
Since I am providing the key pair programatically, I don't want to use the ssh directory on disk. This has led to me having to specify a directory for these:
Full code example setting key and passphrase on builder:
I've seen some examples across GitHub where the where directory is the repository directory: What would you suggest here? Is there a way to omit setting the ssh folder and home directory? Should I use a temporary directory instead? Thanks |
I don't know what other libraries using this do. Setting the ssh dir to a git working tree directory is a bit strange. I'd never set it to any directory where files may be written from somewhere over the internet, which is what a git fetch does. It should be possible to run this without any files, but it's possible that we overlooked something with that home directory. You would have to set a |
Hi @tomaswolf Thanks for getting back to me. I've tried what you suggested:
When the
The method signatures both specify
and
I believe if these were nullable that would alleviate this? I will open a Bug issue in JGit describing this in more detail. Thanks |
Hello,
I'm using the following JGit and Apache MINA dependencies in my project:
I've created a default
org.apache.sshd.client.SshClient
with:SshClient sshClient = SshClient.setUpDefaultClient();
and then set an instance of the GitSshdSessionFactory on JGits SshSessionFactory:
SshSessionFactory.setInstance(new GitSshdSessionFactory(sshClient));
By default the sshClient is reading the SSH keys I have stored in the
~/.ssh
folder where theconfig
file has the following configuration:I am using a passphrase-less private SSH key.
The question I have is around JGits Git push command call when talking back to the remote repository.
For example,
git clone [email protected]:devvthedev/my-project.git
Made some changes to the repo
Opened the repo using JGit with
Git.open(...)
and get aGit
object backStaged the changes I made and committed them:
I get the following error:
If I provide a CredentialsProvider with the
git
user and no password:It works!
So my question is - why is a CredentialsProvider required given I have configured a
SshSessionFactory
instance?I've also raised this to JGit maintainers here
Thank you
The text was updated successfully, but these errors were encountered: