How I can do
git clone --depth 1 ...
with JGIT library?
You can't, JGit doesn't yet support shallow clones on the client side (it does on the server side, though).
According to the Release notes for version 6.5.0, this has been released on March 15, 2023.
You can now use any of
.setDepth(Integer)
.setShallowSince(Instant)
.setShallowSince(OffsetDateTime)
for example like so:
Git.cloneRepository().setDepth(1)