git receive-pack stops with 0000

2019-07-14 05:30发布

问题:

I'm very new to git and currently trie to setup an environment with gitolite and trac on opensuse.

I managed to migrate an old svn repository with the scripts from http://john.albin.net/git/git-svn-migrate.

Now I'm stuck with the trac/git-integration since the git-receive-pack command doesn't behave as expected.

When performing the below command, it hangs after printing 0000 and I got to press CTRL+C to return.

$ git-receive-pack .
0072c0b863c86da4bb75caa8cb5b6cd46604096b84e9 refs/heads/master report-status delete-refs side-band-64k ofs-delta
0046c0b863c86da4bb75caa8cb5b6cd46604096b84e9 refs/remotes/origin/HEAD
0048c0b863c86da4bb75caa8cb5b6cd46604096b84e9 refs/remotes/origin/master
0000

I tried to execute the command on the fresh migrated repository, on the gitolite admin repository and on a local clone on my windows client with git on cygwin. In all cases I'm stuck with the above behaviour.

receive-pack returns some probably correct lines, followed by 0000 and hangs.

Does anyone have an idea what here is going on?

All comments on git-receive-pack focus on certificate or path errors - and they all work completely or not. But in my case it returns a few lines and stops???

Why do I ask this?

My trac installation return the following error:

Trac[git_fs] ERROR: GitError: Could not retrieve GIT version (tried to execute/parse '/usr/bin/git-receive-pack --version' but got ValueError('need more than 0 values to unpack',))

Cloning, pulling and pushing seems to work, but I've had another error with an 'ä' in a tag name in svn which caused problems with gitolite after svn-to-git-migration. So I thought there might by another issue with git.

回答1:

As mentioned by the man page

Invoked by git send-pack and updates the repository with the information fed from the remote end.

This command is usually not invoked directly by the end user.
The UI for the protocol is on the git send-pack side, and the program pair is meant to be used to push updates to remote repository

So don't spend too much time testing that command. Check if you can clone/push/pull your repos.



回答2:

Your research have taken you in a wrong direction. The problem is how openSUSE builds and installs Git, and the way it links the executables - just follow this chain:

  1. /usr/bin/git -> ../lib/git/git-add
  2. /usr/lib/git/git-add -> git
  3. /usr/lib/git/git -> ../../bin/git-receive-pack

As Trac originally made the [git] git_bin a PathOption, Trac would actually resolve the path including links and actually execute /usr/bin/git-receive-pack --version. The problem is of course that git-receive-pack does not support a --version argument and therefore fails.

This has been changed in recent Trac version, see http://trac.edgewall.org/ticket/10997

The patch to fix it for older Trac and plugin versions is trivial (PathOption -> Option).