Skip to content

Checkout breaks symlinked gitconfig on self-hosted runner #650

Open
@msdrigg

Description

@msdrigg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions