KALLITHEA_EXTRAS environment variable missing

Mads Kiilerich mads at kiilerich.com
Tue Dec 24 14:47:50 UTC 2019


On 12/24/19 7:49 AM, Ed Wong wrote:
> Hi,
>
> Just managed to work around the database unicode issue and
> could both clone and push via the ssh:// url; however,
> pushing to a git repository gave me the following 'error':
>
> Total 3 (delta 1), reused 0 (delta 0)
> remote: Traceback (most recent call last):
> remote:   File "hooks/post-receive", line 38, in <module>
> remote:     main()
> remote:   File "hooks/post-receive", line 34, in main
> remote:
> sys.exit(kallithea.lib.hooks.handle_git_post_receive(repo_path,
> git_stdin_lines))
> remote:   File
> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/hooks.py",
> line 343, in handle_git_post_receive
> remote:     baseui, repo = _hook_environment(repo_path)
> remote:   File
> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/hooks.py",
> line 310, in _hook_environment
> remote:     extras = get_hook_environment()
> remote:   File
> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/utils2.py",
> line 538, in get_hook_environment
> remote:     raise Exception("Environment variable KALLITHEA_EXTRAS not
> found")
> remote: Exception: Environment variable KALLITHEA_EXTRAS not found
> To seavcs:repos/infrastructure/testgit2
>     887eb3c..19b77cd  master -> master
>
> Apparently, it did save the push.
>
> I've looked at the documentation; but haven't yet seen the mention
> of the KALLITHEA_EXTRAS requirement.  Looking at the code,
> I'm not exactly sure what fields are required in the json
> structure.

KALLITHEA_EXTRAS is used internally. The user invokes "kallithea-cli 
ssh-serve" when connecting through ssh, and that sets this environment 
variable before calling out to the git executable ... and when git 
invoke the hooks and call back into Kallithea code in a grand-child 
process, it can read the environment variable and report correctly who 
is doing what.

It seems like you somehow end up invoking git directly when you ssh, 
instead of hitting the kallithea-cli that should have been installed in 
your ~/.ssh/authorized_keys ?

I guess we should make the hooks handle a missing KALLITHEA_EXTRAS in a 
more elegant way ...

/Mads



More information about the kallithea-general mailing list