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

SSH config cleanup not done #184

Open
kcarlson opened this issue May 25, 2023 · 3 comments
Open

SSH config cleanup not done #184

kcarlson opened this issue May 25, 2023 · 3 comments

Comments

@kcarlson
Copy link

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}
@ILikeYourHat
Copy link

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

@kcarlson
Copy link
Author

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.

damyan added a commit to ironcore-dev/metalnet that referenced this issue Oct 5, 2023
`setup-git-redirect.sh` is needed for tests, because go needs SSH
authentication, when downloading modules dependencies. The redirect
script, though, does not revert the global changes done to the git
config (in that case: SSH instead of HTTPS). The `checkout` action,
on the other hand, needs the HTTPS for checkout, because the SSH key at the
beginning of the action is no longer available, it was properly cleaned
up in the `webfactory/ssh-agent` post clean up.

Implementing workaround as in webfactory/ssh-agent#184
damyan added a commit to ironcore-dev/metalnet that referenced this issue Oct 5, 2023
`setup-git-redirect.sh` is needed for tests, because go needs SSH
authentication, when downloading modules dependencies. The redirect
script, though, does not revert the global changes done to the git
config (in that case: SSH instead of HTTPS). The `checkout` action,
on the other hand, needs the HTTPS for checkout, because the SSH key at the
beginning of the action is no longer available, it was properly cleaned
up in the `webfactory/ssh-agent` post clean up.

Implementing workaround as in webfactory/ssh-agent#184
guvenc pushed a commit to ironcore-dev/metalnet that referenced this issue Oct 5, 2023
`setup-git-redirect.sh` is needed for tests, because go needs SSH
authentication, when downloading modules dependencies. The redirect
script, though, does not revert the global changes done to the git
config (in that case: SSH instead of HTTPS). The `checkout` action,
on the other hand, needs the HTTPS for checkout, because the SSH key at the
beginning of the action is no longer available, it was properly cleaned
up in the `webfactory/ssh-agent` post clean up.

Implementing workaround as in webfactory/ssh-agent#184
guvenc pushed a commit to ironcore-dev/metalnet that referenced this issue Oct 5, 2023
`setup-git-redirect.sh` is needed for tests, because go needs SSH
authentication, when downloading modules dependencies. The redirect
script, though, does not revert the global changes done to the git
config (in that case: SSH instead of HTTPS). The `checkout` action,
on the other hand, needs the HTTPS for checkout, because the SSH key at the
beginning of the action is no longer available, it was properly cleaned
up in the `webfactory/ssh-agent` post clean up.

Implementing workaround as in webfactory/ssh-agent#184
@tonynajjar
Copy link

I also have this issue, any news?

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

3 participants