Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] git clone via secured connection

On Thu, Feb 28, 2013 at 7:09 PM, nappel
<only4mailinglists@xxxxxxxxxxxxxx> wrote:
> Iam trying to clone a repository with jgit and jsch but Iam  always getting
> an Auth fail with my self written client, but on another computer it works
> fine with this URL.
> And my code:
> public class CustomJschConfigSessionFactory extends JschConfigSessionFactory
> {
>   @Override
>   protected void configure(OpenSshConfig.Host host, Session session) {
>       session.setConfig("StrictHostKeyChecking", "no");
>   }
> }
> The settings and clonging part:
> CloneCommand clone = git.cloneRepository();
>      try {
>          CustomJschConfigSessionFactory jschConfigSessionFactory = new
> CustomJschConfigSessionFactory();
>          JSch jsch = new JSch();
>          jsch.addIdentity(pathToKey);
>          SshSessionFactory.setInstance(jschConfigSessionFactory);

This key is not connected to the objects JGit is using... which is
probably why you are getting an authentication failure. Don't you need
to add the key inside of the jschConfigSessionFactory?

> Is it necessary to add a CredentialProvider? If yes, what should be provided
> there and how? Or could be the problem, the user@android Iam not sure what
> the real hostname of the devise or the username is.

The name in the last column of the key (e.g. "user@android") is just a
comment. It is there to help you remember what the key was created for
when you paste it into an authorized_keys file. It doesn't need to
match anything real.

Back to the top