-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git config safe.directory inside docker containers #2033
Comments
Hi @EdJoPaTo, Thank you for reporting this so clearly! I have applied appropriate labels and added this issue to the backlog |
Got the same issue, though in different scenario. My workaround was to just change owner of the directory after checkout:
|
Signed-off-by: oleg.hoefling <[email protected]>
Signed-off-by: oleg.hoefling <[email protected]>
Quick fix for actions/runner#2033
I've also encountered this issue when running my Docker images on GitHub Actions, and have been able to reproduce while running my container locally. This seems to be more generally a problem with running a Docker container as the root user, while having data mounted for a regular user account. When testing locally, I can start my Docker container by adding the flag |
As the gitconfig is edited, we hit actions/runner#2033 Fixing it by adding ` /github/workspace` as safe.directory
…#19720) Closes #19712 This PR introduce a workaround for actions/runner#2033. This workaround was already introduced in #19703 in some of the jobs. `actions/checkout` has an issue filled about this too: actions/checkout#1169
The CI build issue was an "unsafe" git dir. actions/checkout@v4 is supposed to fix that; see comments in actions/runner#2033. Signed-off-by: Gary Oberbrunner <[email protected]>
Uses a technique documented at actions/runner#2033 (comment) to run the CI jobs as the `runner` user to fix a log error.
When using a github runner, the problem does not occur. I am using a container to run the action in. The same container and workflow config works with github runner but not with a self-hosted runner. Can anyone explain this? There is no .gitconfig in the container in both cases... |
…/test-reporter#131 (comment)> and <actions/runner#2033>. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@20679 56274372-70c3-4bfc-bfc3-4c3a0b034d27
[New] build: CI: GitHub: Add Fedora builder. ........ [Fix] build: CI: GitHub: Fedora: Fix xz dependency install. ........ [Fix] build: CI: GitHub: Fedora: Workaround GitHub quirks. See <dorny/test-reporter#131 (comment)> and <actions/runner#2033>. ........ [Imp] build: CI: GitHub: Fedora: Add matrix build for dependencies. ........ [New] build: CI: GitHub: Add Fedora Autotools builder. ........ [New] build: CI: GitHub: Add Fedora MinGW cross-compile builder. ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.31@20689 56274372-70c3-4bfc-bfc3-4c3a0b034d27
Due to a known bug in actions (actions/runner#2033) the user inside the docker container doesn't have ownership over the repo and adding the directory as safe is ineffective.
Describe the bug
Recent versions of git require the
.git
folder to be owned by the same user. (as described here).The
actions/checkout
action sets this for the cloned repo (/usr/bin/git config --global --add safe.directory …
). Also see actions/checkout#766Running a container (via
uses: docker://…
) however switches the user context and all git commands will fail with an error:Inspecting the
docker run
command theHOME
variable is set and the home inside the container seems to be/github/home
which is mapped to/home/runner/work/_temp/_github_home
.Creating the
.gitconfig
in this location before running the container resolves this problem:As these paths (
HOME
andPWD
inside the container) are not stable and can be changed any time, thegit config …
logic should be done by the runner executing the docker command as its the only part in the process knowing these paths.I do not think this is related to the images as the
uses: docker://
logic is handled by the runner itself?To Reproduce
Steps to reproduce the behavior:
Create this minimal workflow and let it run
(See above for the error message of the git command)
Expected behavior
The container should have a
.gitconfig
to run git commands normally like it is possible without container.Stuff like the
.git
folder is mounted to the container too so a user can expect git to work fine.Runner Version and Platform
Version of your runner? Hosted Runners on GitHub
The text was updated successfully, but these errors were encountered: