JGit authentification with http token

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:


Than we can clone the repository:

var repository = "https://github.com/eclipse-jgit/jgit.git";
var directory = "./directory";
var token = "ThisIsTheToken

​.setCredentialsProvider(new UsernamePasswordCredentialsProvider("token", token))
​.setDirectory(new File(directory))

Use JGIT with SSH