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

SSH config cleanup not done

Open kcarlson opened this issue 1 year ago • 5 comments

The modified git config is not cleaned up after a run, e.g. the url git@key- section. This will affect a subsequent run on, for example, a self-hosted runner.

We are using a workaround which may help someone:

- name: Restore git global config
  if: always()
  run: |
    MATCH=$(grep -o 'git@key-[^"]*\.github\.com:.*/[^"]*' ~/.gitconfig)
    git config --global --remove-section url.${MATCH}

kcarlson avatar May 25 '23 08:05 kcarlson

@kcarlson would this workaround also work when multiple keys are provided?

ILikeYourHat avatar Jul 11 '23 15:07 ILikeYourHat

I've only tested it with a single key being provided to the ssh-private-key field. If multiple keys end up under the same section in the .gitconfig, it should work, otherwise, if there are multiple sections, MATCH will have multiple matches and the ´git config´ command will not work.

kcarlson avatar Jul 11 '23 17:07 kcarlson

I also have this issue, any news?

tonynajjar avatar Jan 31 '24 12:01 tonynajjar