Checkout breaks symlinked gitconfig on self-hosted runner
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.9k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
I am running actions on a self-hosted runner and my $HOME/.gitconfig is symlinked somewhere else (thanks to https://github.com/anishathalye/dotbot). When I run github actions, I see that the following lines have been added to my gitconfig.
[http "https://github.com/"]
extraheader = AUTHORIZATION: basic *** [it was a token]
[url "https://github.com/"]
insteadOf = git@github.com:
insteadOf = org-45189381@github.com:
I tracked this down to several lines in the self-hosted runner logs:
2021-12-04T01:29:22.8379527Z Switched to a new branch 'main'
2021-12-04T01:29:22.8380661Z Branch 'main' set up to track remote branch 'main' from 'origin'.
2021-12-04T01:29:22.8382186Z ##[endgroup]
2021-12-04T01:29:22.8383552Z ##[group]Setting up auth for fetching submodules
2021-12-04T01:29:22.8385435Z Copying '/home/user/.gitconfig' to '/home/user/.local/share/actions-runner/_work/_temp/1ccda36a-b42c-42b0-9664-29b4f1e31ba3/.gitconfig'
2021-12-04T01:29:22.8396391Z Temporarily overriding HOME='/home/user/.local/share/actions-runner/_work/_temp/1ccda36a-b42c-42b0-9664-29b4f1e31ba3' before making global git config changes
2021-12-04T01:29:22.8398638Z [command]/usr/bin/git config --global http.https://github.com/.extraheader AUTHORIZATION: basic ***
2021-12-04T01:29:22.8427546Z [command]/usr/bin/git config --global --unset-all url.https://github.com/.insteadOf
2021-12-04T01:29:22.8451850Z [command]/usr/bin/git config --global --add url.https://github.com/.insteadOf git@github.com:
2021-12-04T01:29:22.8473658Z [command]/usr/bin/git config --global --add url.https://github.com/.insteadOf org-45189381@github.com:
2021-12-04T01:29:22.8494913Z ##[endgroup]
2021-12-04T01:29:22.8496341Z ##[group]Fetching submodules
2021-12-04T01:29:22.8497466Z [command]/usr/bin/git submodule sync --recursive
It seems that when the checkout action copies $HOME/.gitconfig to temporarily modify it, it copies the symlink and so the changes propagate to the main file as well.
This is a big issue because the updated .gitconfig cannot push or pull any of my repos. So I have to constantly go back and edit the ~/.gitconfig to fix this problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the checkout action's self-hosted submodule-authentication setup, focusing on the step that copies ~/.gitconfig before running git config changes. Reproduce with a symlinked gitconfig and verify that the original file remains unchanged while submodule authentication still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100