Details
-
Improvement
-
Resolution: Fixed
-
Major
-
9.8
-
None
Description
When trying to clone a non-public repository, a JGit TransportException is thrown. Since the cloning is actually done in the GitManager, there's no way to add authentication manually. JGit is expecting some CredentialsProvider.
I see two possible solutions:
- Add an overridden getRepository method, that accepts a CredentialsProvider as third argument. In that case the code of the DefaultGitManager should be changed a bit:
// Step 2.1: Need to clone the remote repository since it doesn't exist git.cloneRepository() .setDirectory(localDirectory) .setURI(repositoryURI) .setCredentialsProvider(credentialsProvider) // this line should be added .call();
- Split up the getRepository method and expose a method getLocalGitDirectory, in that case you can choose in a script to only use the getLocalGitDirectory method and do the actual clone yourself. This is probably a more complex change, but it gives more flexibility.