Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Cloning LFS repository ignores passed credentials

I'm cloning Git repos using this code, however, no LFS content is resolved accordingly.

Git.cloneRepository()
        .setURI(repositoryUrl)
        .setCredentialsProvider(new UsernamePasswordCredentialsProvider(credentials.getUser(), credentials.getPassword()))
        .setDirectory(folderPath.toFile())
        .setBranchesToClone(Arrays.asList("refs/heads/" + branchName))
        .setBranch("refs/heads/" + branchName)
        .call();

Is it necessary to tweak some additional option besides adding this optional dependency?
<dependency>
    <groupId>org.eclipse.jgit</groupId>
    <artifactId>org.eclipse.jgit.lfs</artifactId>
    <version>5.4.2.201908231537-r</version>
</dependency>

If native Git+LFS clients are present in the system, the repository is cloned until visiting the first LFS item, which triggers the Windows Credential window asking to enter remote server (GitLab) credentials.

I thought native tools are ignored in case of LFS dependency. Anyway, if native Git can work with UsernamePasswordCredentialsProvider, why LFS doesn't use it as well?

I am failing to find any documentation to setup LFS correctly. Any clarification would be helpful.

Thanks,

Jan

Back to the top