Skip to main content

GitHub SSH Key Updates

When the GitHub client SSH key expires, any checked out repository must be updated to use the new key.

This is because we embed key properties in its name.

And with many active repositories checked out for development, updating each one is tedious and error-prone.

And since TortoiseGit assigns SSH keys, to each repository, without any explicit sharing, every checked out repository must be updated.

Luckily, the key path is set in a config file of each checked out repo, that resembles an INI file.

We cooked up a dotnet tool that will update SSH client keys for all repos.

It will iterate all checked out git repos in: c:\Projects.

It searches for every config file inside a .git folder.

If found, it checks that the repo URL belongs to one of our orgs.

And if so, it updates the Putty Key file to whatever path we require.

The VS Solution is here: C:\Projects\OGA.Tools\OGA.GitCheckout.Tools\OGA.GitCheckout.Tools\OGA.GitCheckout.Tools

When it’s necessary to run it again, just update the static public properties in Program.cs, with the new key path.

And, add any orgs that may be missing.

Then, run it against the C:\Projects folder, to update all checked out repositories.