Skip to content

'Support for GitHub deploy keys' breaks local CI for repositories which are submodules of other repositories which use ssh-agent with local CI #218

@AlistairMcCutcheonIAS

Description

@AlistairMcCutcheonIAS

Versions:

How to reproduce:

  1. Create two repositories, repo_1 and repo_2.
  2. Make repo_1 use repo_2 as a submodule as per https://github.com/webfactory/ssh-agent?tab=readme-ov-file#support-for-github-deploy-keys
  3. Run CI on repo_1 on a local runner. This will add the url..insteadof to the global .gitconfig of that runner.
  4. Run CI on repo_2 on the same local runner. When trying to checkout the repository, the checkout will be redirected to use the deploy key in ~/.ssh/ (added by repo_1's CI) rather than the PAT. This will cause the checkout action to fail, with the following error:
Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +9849...41:refs/remotes/pull/7/merge
  Load key "/home/docker/.ssh/key-3e0...9f[40](https://github.com/org/repo/actions/runs/87...80/job/2...5#step:2:45)b75...5d9": invalid format
  [email protected]: Permission denied (publickey).
  Error: fatal: Could not read from remote repository.

Workaround:

  • Deleting the global .gitconfig before each run stops the issue

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