ssh-agent icon indicating copy to clipboard operation
ssh-agent copied to clipboard

Key isn't removed after job is done

Open BRA1L0R opened this issue 3 years ago • 2 comments

After the job is done the ssh key persists in the self-hosted runner and eventually the keys build up into a larger and larger file. This also conflicts with other repo's runners.

BRA1L0R avatar Sep 05 '22 14:09 BRA1L0R

Does this only affect the SSH config file, or also the .gitconfig?

mpdude avatar Sep 06 '22 17:09 mpdude

Does this only affect the SSH config file, or also the .gitconfig?

I don't know as I switched to running a separate container for each runner.

BRA1L0R avatar Sep 06 '22 21:09 BRA1L0R

I'm having this same issue. I can confirm that in fact this affects both .gitconfig and ~/.ssh/config. Also there's no cleanup of the key files that keeps generating in the ~/.shh directory. As mentioned in #106 known_host file keeps growing with each run in the self-hosted runner.

It's also an issue to keep the .gitconfig keys, since the ssh runner stopped, the references in this file are no longer valid and git raises an [email protected]: Permission denied (publickey) error whenever I try to clone the repository manually afterwards; although it seems that this could be fixed by running the runner in a dedicated user.

Should this kind of cleanup be done after the action is finished?

bfontan avatar Dec 19 '22 12:12 bfontan

I was experiencing this as well. I ended up writing a compatible action available here: https://github.com/marketplace/actions/ssh-agent-deploy-key

cardoe avatar Mar 07 '23 16:03 cardoe