Open HannesWell opened 8 months ago
If I try to push via git CLI (which ships with git-lfs by default on windows) I get the following error
$ git push
To github.com:HannesWell/my.git.lfs.tests.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:HannesWell/my.git.lfs.tests.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
But if I fetch I see no other commits or remote reference updates.
So it looks like the push is not fully rejected but somehow incomplete.
If I try to push via git CLI (which ships with git-lfs by default on windows) I get the following error
From some more experiments I've got the impression that this is not caused by an imcomplet push through JGit, but also seem to happen when one pushes to a fork of a repository. At least in that case pushes of new LFS-objects to new branches lead to the same error with JGit and CLI git. Adding a .lfsconfig
like the following makes CLI git work (in this case to push to my SWT clone):
[lfs]
url = https://lfs.github.com/eclipse-platform/eclipse.platform.swt
But then JGit fails with the following error if I try to push some LFS-objects:
eclipse.buildId=4.31.0.I20231230-1800
java.version=17.0.7
java.vendor=GraalVM Community
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86_64
org.eclipse.egit.core
Error
Wed Jan 03 00:52:55 CET 2024
An exception occurred during push on URI git@github.com:HannesWell/eclipse.platform.swt.git: When trying to open a connection to https://lfs.github.com/eclipse-platform/eclipse.platform.swt/objects/batch the server responded with an error code. rc=401
org.eclipse.jgit.errors.TransportException: When trying to open a connection to https://lfs.github.com/eclipse-platform/eclipse.platform.swt/objects/batch the server responded with an error code. rc=401
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:174)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1557)
at org.eclipse.egit.core.op.PushOperation.run(PushOperation.java:269)
at org.eclipse.egit.ui.internal.push.PushJob.performJob(PushJob.java:86)
at org.eclipse.egit.ui.internal.jobs.RepositoryJob.run(RepositoryJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.io.IOException: When trying to open a connection to https://lfs.github.com/eclipse-platform/eclipse.platform.swt/objects/batch the server responded with an error code. rc=401
at org.eclipse.jgit.lfs.LfsPrePushHook.requestBatchUpload(LfsPrePushHook.java:200)
at org.eclipse.jgit.lfs.LfsPrePushHook.call(LfsPrePushHook.java:105)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:172)
... 5 more
I also debugged this from an J/EGit workspace, but I'm puzzled why the lfs.url
available anywhere else than LfsConnectionFactory.getLfsUrl()
? Could it be that looking up the LF storage using LfsConnectionFactory.getSshAuthentication()
respectively git-lfs-authenticate
somehow creates a session or alike that is used to also authenticate the subsequent LFS-object upload?
I have the same issue with external lfs storage using ssh connection:
In our environment we try to use external lfs storage via ssh connection.
This works well in command line but not within eclipse / jgit.
There we get the error message unknown protocol: ssh
configuration eample: .lfsconfig
[lfs]
url = ssh://git@<jfrog-artifactory-url>:<port>/artifactory/lfs-reopsitory
ussed environment: git: Bitbucket lfs-storage: jfrog artifactory
Version
6.9.0
Operating System
Windows
Bug description
Trying to push a commit to GitHub that contains a new Large File Storage (LFS) object fails with a message that says that the referenced LFS object is missing![grafik](https://github.com/eclipse-jgit/jgit/assets/44067969/1eb9aca2-7973-4eb9-96a8-dbccd539a8dc)
But the object exists in the local LFS cache and I also debugged the code and verified that
LfsPrePushHook.uploadFile()
is called and succeeds for the file mentioned in the error message. Switching between the Apache Http and the JDK's http client makes no difference.Actual behavior
Pushing failes with the described message.
Expected behavior
Push succeeds and the LFS objects are properly pushed along with the pointer file.
Relevant log output
Other information
The repositories
.git/config
:My global
~/.gitconfig