dawidd6 / action-debian-package

:gear: A GitHub Action for building Debian packages
MIT License
24 stars 8 forks source link

tell git to trust the repo #69

Closed SebKuzminsky closed 1 year ago

SebKuzminsky commented 1 year ago

Recent versions of git do not like to run as root in repos that are not owned by root. This is commonly the situation when a user checks out a git repo, then runs a docker container with the repo mounted in it.

The version un debian unstable (1:2.38.1-1) has this issue. The version in bullseye (1:2.30.2-1) does not have this issue.

git-deborig gives this unhelpful error message:

$ git deborig HEAD
pwd doesn't look like a git repository ..

Regular git gives this more useful error message:

$ git status
fatal: detected dubious ownership in repository at '/data/home/seb/action-debian-package'
To add an exception for this directory, call:

        git config --global --add safe.directory /data/home/seb/action-debian-package

This commit fixes the issue by running the recommended command inside the container, before trying to access the git repo.

Fixes #62.

dawidd6 commented 1 year ago

Great find! Thanks, one style suggestion only.