CLI demo push error

Hi,

I’m trying out the CLI demo, but I can’t seem to make it work. This is the error I get after adding a file to parent/app and trying to pushing it to parent.git:

git push
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 326 bytes | 326.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Error: Could not find or load main class org.tmatesoft.gitx.cli.install.GxPreReceiveHook
remote: Caused by: java.lang.ClassNotFoundException: org.tmatesoft.gitx.cli.install.GxPreReceiveHook

Hello Panolo,
the ‘pre-receive’ hook (located at GIT_REPO/hooks/pre-receive) just tries to run org.tmatesoft.gitx.cli.install.GxPreReceiveHook class from gx/lib/gitx-VERSION-BUILD_fat.jar

...
ARGUMENTS=""

umask 0022

# echo "Running Java pre-receive hook"
echo "$HOOK_INPUT" | "$JAVA_EXE" $JAVA_OPTIONS -cp "$GX_CLASSPATH" $MAIN_CLASS  "$GIT_REPOS" $ARGUMENTS

May I ask you to

  • check that you have “fat jar” file inside GIT_REPO/gx/lib/
  • check that the “fat jar” indeed contains GxPreReceiveHook.class file by unzipping it;
  • edit the hook to add
echo "$JAVA_EXE" $JAVA_OPTIONS -cp "$GX_CLASSPATH" $MAIN_CLASS  "$GIT_REPOS" $ARGUMENTS

before the last line of the hook and re-try pushing.

This will print the command the hook is trying to execute. There’s a chance that you would notice something wrong with it…

May I also ask what is you OS and Java version?

Finally I would like to note that recently we’ve fixed several major issued in the tool and will publish an update soon. I hope we will be able to fix yours as well.

Yeah, it appears that the fat jar is missing. I can only see a gitx-cli-1.0.0-beta1.jar and a gitx-core-1.0.0-SNAPSHOT.jar

I’m currently on Win 10, using Java 15.0.2

I mean that the fat jar should directly inside the Git repository:
GIT_REPO/gx/lib/gitx-VERSION-BUILD_fat.jar not in the command line tool distribution.

The fat jar consists of all jars from the distribution dumped into a single file. So the ‘pre-receive’ hook in the Git repository will just execute a certain class in it.

Thanks a lot, I figured out what was wrong. It’s now working properly.

Could you tell us what it was? Maybe it’s something we should fix in the tool itself…

It was probably a wrong clone operation that messed up my project. Solved by redoing everything from scratch.