Skip to content

import of .gitconfig on self-hosted runner causing git fetch failure #1724

Open
@twojstaryzdomu

Description

@twojstaryzdomu

The checkout action, running on a self-hosted runner, is failing to import additional files referenced within .gitconfig. My case is as follows, the config_github file which specifies the user and the key is not copied across into the environment, causing the job to fail to read from the repo.

Now, when not on self hosted, the above isn't happening. Can we forgo importing the .gitconfig altogether or be able to specify a list of additional local files, like ~/.ssh/config_github and ~/.ssh/id_rsa_github to be imported into the self-hosted runner?

# cat ~/.gitconfig 
<snip>
[core]
  sshCommand = "ssh -F ~/.ssh/config_github"

# cat ~/.ssh/config_github
Host github.com github g
  HostName github.com
  User git  
  IdentityFile ~/.ssh/id_rsa_github

The error related to the failure:

##[endgroup]
Copying '/home/pi/.gitconfig' to '/misc/githubrunner/_work/_temp/a98c99b5-92ca-4c31-992c-ec1bd888e283/.gitconfig'
<snip>
##[group]Fetching the repository
[command]/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
Can't open user config file /misc/githubrunner/_work/_temp/a98c99b5-92ca-4c31-992c-ec1bd888e283/.ssh/config_github: No such file or directory
##[error]fatal: Could not read from remote repository.

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