In this guide I will show you how to set up JGIT using a http token
First of all we need to import the maven dependencies:
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.8.0.202311291450-r</version>
</dependency>
Than we can clone the repository:
var repository = "https://github.com/eclipse-jgit/jgit.git";
var directory = "./directory";
var token = "ThisIsTheToken
Git.cloneRepository()
.setURI(repository)
.setCredentialsProvider(new UsernamePasswordCredentialsProvider("token", token))
.setDirectory(new File(directory))
.call();