我解决了一个类似的问题。这可能与您的情况不完全一样,但您可以尝试重新应用我所做的相同故障排除。
我意识到,当我为新用户推送密钥时,我得到了这个堆栈跟踪,这是 gitosis 的钩子无法处理新密钥的症状。
remote: Traceback (most recent call last):
remote: File "/usr/local/bin/gitosis-run-hook", line 9, in <module>
remote: load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-run-hook')()
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 24, in run
remote: return app.main()
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 38, in main
remote: self.handle_args(parser, cfg, options, args)
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/run_hook.py", line 81, in handle_args
remote: post_update(cfg, git_dir)
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/run_hook.py", line 45, in post_update
remote: config=cfg,
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/gitdaemon.py", line 95, in set_export_ok
remote: for (dirpath, repo, name) in walk_repos(config):
remote: File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/gitdaemon.py", line 72, in walk_repos
remote: assert ext == '.git'
remote: AssertionError
该错误仅显示ONCE,因此我天真地将其视为暂时失败。
实际上,Gitosis 仅适用于我的密钥,但不适用于我试图支持的任何用户。在~/.ssh/authorized_keys
我找不到我以为我刚刚添加的用户的公钥中。这就是为什么我的朋友每次尝试克隆时都被要求输入密码的原因。
我通过将这两行添加到 Gitosis 配置中添加了调试gitosis.conf
[gitosis]
loglevel=DEBUG
我不得不继续在 gitosis.conf 文件中添加和删除用户,以便再次触发挂钩。我的调试日志显示
remote: DEBUG:gitosis.gitdaemon:Deny 'syncShare'
remote: DEBUG:gitosis.gitdaemon:Walking 'legacy.d', seeing ['buildtools', 'QA_Dashboard']
remote: DEBUG:gitosis.gitdaemon:Walking 'legacy.d/buildtools', seeing ['.git', 'conf', 'scripts']
remote: Traceback (most recent call last):
etc ...
啊哈!当钩子在存储库中执行“遍历”时,它找到了一个.git
目录,legacy.d/buildtools
而这正是assert ext == '.git'
发生的地方。
我曾使用服务器存储来自其他存储库的简单克隆。注意,一个普通的克隆,而不是镜像或裸存储库。像每个克隆一样,它包含 .git 目录。
Gitosis 中的钩子不知道如何处理 .git 目录。它认为它是一个空名称的存储库并中止。一旦我消灭了那个克隆,一切都会恢复正常。