Skip to content
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

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

Open
AlistairMcCutcheonIAS opened this issue Apr 24, 2024 · 0 comments

Comments

@AlistairMcCutcheonIAS
Copy link

AlistairMcCutcheonIAS commented Apr 24, 2024

Versions:

  • actions/checkout@v4
  • webfactory/ssh-agent@v0.7.0

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
  git@github.com: Permission denied (publickey).
  Error: fatal: Could not read from remote repository.

Workaround:

  • Deleting the global .gitconfig before each run stops the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant