Skip to content

Error installing packages from private github repos when running in a git post-receive hook #16102

@BradleyKirton

Description

@BradleyKirton

Summary

Hi there 👋

I am trying to make use of uv to run a CLI tool within a git post-receive hook. The CLI tool is hosted in a private github repo. I did some searching through the existing issues and found an issue which looks similar but was closed due to inactivity.

My post-receive hook looks like this.

#!/usr/bin/env bash
while read oldrev newrev ref; do
    if [[ $ref =~ .*/main$ ]];
    then
        pusher=$(git config --get remote.pushuser)
        pusher=${pusher:-$USER}

        uv tool run \
            --verbose \
            --from bou@git+ssh://git@github.com/BradleyKirton/bou.git@main \
            bou \
            build $ref $pusher
    else
        echo "Ref $ref successfully received."
    fi
done

When the hook runs I get the following error.

remote:   × Failed to download and build `bou @
remote:   │ git+ssh://git@github.com/BradleyKirton/bou.git@main`
remote:   ├─▶ Git operation failed
remote:   ╰─▶ process didn't exit successfully: `/usr/lib/git-core/git rev-parse`
remote:       (exit status: 128)
remote:       --- stderr
remote:       fatal: not a git repository: '.'

If I manually run the hook it works.

echo "sha sha refs/heads/main" | example/repo/hooks/post-receive

Platform

Linux 6.16.8-arch3-1 x86_64 GNU/Linux

Version

uv 0.8.22

Python version

Python 3.13.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions