Community
Participate
Working Groups
For example we have git repository https://git-server.com/foo/bar and it uses LFS. Native git supports cloning (and checkout later) for both urls: 1) https://git-server.com/foo/bar 2) https://git-server.com/foo/bar.git If you use JGit with built-in LFS support, only second case works. First case doesn't work, we get error message: "When trying to open a connection to https://github.com/sanail/tmp-lfs/info/lfs/objects/batch the server responded with an error code. rc=403" According to Git LFS documentation both URLs are correct and should work. Please see this document: https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md ***** quote ***** Guessing the Server By default, Git LFS will append .git/info/lfs to the end of a Git remote url to build the LFS server URL it will use: Git Remote: https://git-server.com/foo/bar LFS Server: https://git-server.com/foo/bar.git/info/lfs Git Remote: https://git-server.com/foo/bar.git LFS Server: https://git-server.com/foo/bar.git/info/lfs ***** quote ***** In the JGit only second case is supported for now. Example of the code: BuiltinLFS.register(); try (Git cloned = Git.cloneRepository() .setURI(uri) .setDirectory(local) .setNoCheckout(true) .call()) { String branch = "main"; cloned.branchCreate() .setName(branch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK) .setStartPoint(Constants.DEFAULT_REMOTE_NAME + "/" + branch) .call(); LfsFactory.getInstance().getInstallCommand().setRepository(cloned.getRepository()).call(); cloned.checkout().setName(branch).call(); }
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/190527
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/190527 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=a054f3ce76c2aaeada7fc9b84f23a3eceb2f7708
Thanks, Nail!