[Question] How to get information in post-receive git hook #745

Closed
opened 2025-11-02 03:35:00 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @UziTech on GitHub (May 25, 2017).

How can I get the information provided to stdin in the git post-receive hook?

I've tried

read var
echo $var

and it returns nothing

Originally created by @UziTech on GitHub (May 25, 2017). How can I get the information provided to stdin in the git post-receive hook? I've tried ```sh read var echo $var ``` and it returns nothing
GiteaMirror added the type/question label 2025-11-02 03:35:00 -06:00
Author
Owner

@bkcsoft commented on GitHub (Jun 8, 2017):

post-receive hook doesn't get anything from stdin. See git documentation on how to use it: https://git-scm.com/docs/githooks

@bkcsoft commented on GitHub (Jun 8, 2017): `post-receive` hook doesn't get anything from stdin. See git documentation on how to use it: https://git-scm.com/docs/githooks
Author
Owner

@UziTech commented on GitHub (Jun 8, 2017):

post-receive

This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. It executes on the remote repository once after all the refs have been updated.

This hook executes once for the receive operation. It takes no arguments, but gets the same information as the pre-receive hook does on its standard input.

@UziTech commented on GitHub (Jun 8, 2017): > **post-receive** > >This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. It executes on the remote repository once after all the refs have been updated. > > This hook executes once for the receive operation. It takes no arguments, but **_gets the same information as the pre-receive hook does on its standard input_**.
Author
Owner

@UziTech commented on GitHub (Jun 8, 2017):

pre-receive

This hook executes once for the receive operation. It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:

<old-value> SP <new-value> SP <ref-name> LF

@UziTech commented on GitHub (Jun 8, 2017): > **pre-receive** > > This hook executes once for the receive operation. It takes no arguments, but for each ref to be updated it receives on standard input a line of the format: > > `<old-value> SP <new-value> SP <ref-name> LF`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#745