Repository navigation
Description
Version
6.10.0.202406032230-r
Operating System
Linux/Unix
Bug description
I'm having trouble in trying to work with a git repository using JGit and I believe that because this repository is with objectFormat sha256, this may break functionality.
Actual behavior
java.lang.RuntimeException: org.eclipse.jgit.api.errors.JGitInternalException: An exception occurred while trying to add the Id of HEAD
at gss.dms.versioning.Versioning.useJGit(Versioning.java:119)
at gss.dms.versioning.Versioning.calculateVersion(Versioning.java:85)
at gss.dms.versioning.VersioningApplication.call(VersioningApplication.java:44)
at gss.dms.versioning.VersioningApplication.call(VersioningApplication.java:16)
at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at gss.dms.versioning.VersioningApplication.main(VersioningApplication.java:53)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: An exception occurred while trying to add the Id of HEAD
at org.eclipse.jgit.api.LogCommand.call(LogCommand.java:135)
at gss.dms.versioning.Versioning.useJGit(Versioning.java:98)
... 12 more
Caused by: java.io.IOException: Cannot read file .../.git/packed-refs
at org.eclipse.jgit.internal.storage.file.RefDirectory.readPackedRefs(RefDirectory.java:1003)
at org.eclipse.jgit.internal.storage.file.RefDirectory.refreshPackedRefs(RefDirectory.java:975)
at org.eclipse.jgit.internal.storage.file.RefDirectory.getPackedRefs(RefDirectory.java:966)
at org.eclipse.jgit.internal.storage.file.RefDirectory.firstExactRef(RefDirectory.java:353)
at org.eclipse.jgit.lib.RefDatabase.findRef(RefDatabase.java:281)
at org.eclipse.jgit.lib.Repository.findRef(Repository.java:1102)
at org.eclipse.jgit.lib.Repository.resolve(Repository.java:815)
at org.eclipse.jgit.lib.Repository.resolve(Repository.java:473)
at org.eclipse.jgit.api.LogCommand.call(LogCommand.java:127)
... 13 more
Caused by: org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: 6cd515c54340f94cd4150ef3653ca154c0fb2e010ea255017bc82c2ec156c056
at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:203)
at org.eclipse.jgit.internal.storage.file.RefDirectory.parsePackedRefs(RefDirectory.java:1049)
at org.eclipse.jgit.internal.storage.file.RefDirectory.lambda$2(RefDirectory.java:994)
at org.eclipse.jgit.util.FileUtils.readWithRetries(FileUtils.java:733)
at org.eclipse.jgit.internal.storage.file.RefDirectory.readPackedRefs(RefDirectory.java:985)
... 21 moreExpected behavior
I expected JGit to be able to read this .git folder.
Relevant log output
No response
Other information
I've done some research and it seems that this repository has object format sha256 instead of sha1 which leads me to believe that JGit does not support this hashing algorithm yet.
To further test this, I've installed the latest Eclipse 2024-06 available with EGit installed and I tried to add the project and I get the exact same errors.
Another bit of information that I can provide is that the repository was created using a Forgejo server and the person that created it confirmed that he selected sha256 as object format.
I've added this as a bug, because this is unclear to me if it was on a roadmap or not, but feel free to change it to a feature request.
Activity
mitr15fan15v commentedon Jul 19, 2024
Missing Features
There are some missing features:
signing push
shallow and partial cloning
support for remote helpers
support for credential helpers
support for multiple working trees (git-worktree)
using external diff tools
support for HTTPS client certificates
SHA-256 object IDs
git protocol V2 (client side): packfile-uris
multi-pack index
split index
msohn commentedon Jul 30, 2024
JGit doesn't yet support SHA-256 object IDs
theoparis commentedon Sep 22, 2024
Why is this closed if this is not implemented?
msohn commentedon Sep 23, 2024
reopened and marked as enhancement request
bk2204 commentedon Oct 1, 2025
I'll just note that Git 3.0 will make SHA-256 the default algorithm for new repositories. The estimated release timeframe is approximately a year from now, although the exact details are being discussed on the Git list.
stevenschlansker commentedon Jan 28, 2026
We found that this issue blocks OpenGrok using repos with SHA-256 hashes enabled.
joestr commentedon Sep 23, 2026
Can this issue be prioritised somehow?
joestr commentedon Oct 2, 2026
I opened a change request on GerritHub: https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1252947
sebthom commentedon Oct 14, 2026
I would appreciate if this would get addressed. Current user experience is aweful. When one tries to clone a repo with SHA256 the UI shows wild cryptic error messages and when you import a project cloned on the console constantly other kinds of exceptions and errors are poping up. If implementing support is not feasible right now, then please at least raise exceptions with meaningful error messages that are actionable by users.
Geolykt commentedon Oct 14, 2026
What UI are you referring to for reference? jgit by itself has no UI iirc
sebthom commentedon Oct 15, 2026
Its most prominent consumer ... EGit. But egit cannot show anything more meaningful if the underlying library does not provide proper execpetions.
joestr commentedon Oct 19, 2026
Also Apache Netbeans goes haywire if it encounters SHA256 repos.