git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Running git(1) from within hooks/post-update

From
ACAlejandro Colomar <alx@kernel.org>
Date
Nov 24, 2023, 14:00 UTC
Message-ID
<ZWCsd3cJZ3LAqOwg@debian>
Hi,

I'm trying to set up a post-update hook to produce a build of the Linux man-pages PDF book after every push to my personal server to the 'main' branch, so that I can serve man-pages-HEAD.pdf at some URL, for users to be able to easily check the manual at git HEAD without having to clone the repo.

I thought of having a git non-bare repo where I build it, so the script would be the following (the paths are tmp, because I'm still testing).

	$ cat post-update 
	#!/bin/sh
	test "$1" = "refs/heads/main" || exit 0;
	cd ~/tmp/man-pages/;
	whoami; pwd; ls -ld .git/;  # This is for debugging.
	git fetch srv			#>/dev/null 2>&1;
	git reset srv/main --hard	#>/dev/null 2>&1;
	git clean -dffx			#>/dev/null 2>&1;
	scripts/LinuxManBook/build.sh	>~/tmp/LMB-HEAD.pdf &

But it's not working. The git(1) calls are failing, saying it's not a git repo, but it clearly is, and I have permissions, so I don't understand what's going wrong. Here's the 'remote:' output of a push to that testing server:

	remote: alx
	remote: /home/alx/tmp/man-pages
	remote: drwxr-xr-x 8 alx alx 4096 Nov 24 14:41 .git/
	remote: fatal: not a git repository: '.'
	remote: fatal: not a git repository: '.'
	remote: fatal: not a git repository: '.'
	remote: hooks/post-update: 12: ./scripts/LinuxManBook/build.sh: not found
Can you please help?  :)

Thanks, Alex

-- 
<https://www.alejandro-colomar.es/>
Next: Alejandro Colomar
Message 1 of 3 in “Running git(1) from within hooks/post-update”
  1. Alejandro ColomarNov 24, 2023
  2. Alejandro ColomarNov 24, 2023
  3. Alejandro ColomarNov 24, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.