Search code examples
gitantsshgit-clonejgit

how to clone ssh remote repository using jgit and apache ant task?


I have a remote repository with address ssh://[email protected]/git/repository/project.git and password

And i need to clone it using jgit with ant task. Unfortunately i can't clone it with standard jgit git-clone ant task because i get auth error even before being able to type in the password. I tried checking for the solution, but no luck yet. What should i do? should i customize that task somehow?

I have no problem cloning that project with command line git command git clone ssh://[email protected]/git/repository/project.git and stating password after


Solution

  • Aparently JGit's clone task doesn't support password authentication. If you really want to authenticate with a password (the password would end up in the build.xml file) you'd have to write your own ant task or enhance the one that comes with JGit.

    With CloneCommand#setCredentialsProvider() you can specify a CredentialsProvider that can pass on the password from the Ant task to the command.