Git for Windows gotcha after update
Oh, Windows. How do I love thee? Let me count the ways. I'm done counting. Because the ways are none.
In this post, I am taking a break from my usual posts like dependency injection and understanding IoC for a dev journal attempt.
Git security vulnerability announced
After a recent Git security vulnerability, I updated my Git for Windows like a good doggo. And then I lost access to all my work repos. Ah, no problem. Probably just an issue with the SSH keys, right?
Wrong.
But why aren't you using a GUI?
Because it's a GUI. And yes, if I were using a fancy Git GUI like GitKraken or one of those, I may have skipped out on this problem because they have their own shady ways of handling the SSH side of things. But then I wouldn't have learnt anything about how SSH works or how an operating system deals with SSH keys, or even how Windows deals with SSH keys. Yes, that's shade.
I use arch, btw
Yes, that's a troll.
What's the issue?
- you update Git for Windows
- access to your sweet, sweet code is lost as you are met with an error:
Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
- you think it's an issue with your public key
- you generate new SSH keys and add the public keys to your repo
- ???
- profit!!
Not profit. Turns out you should read further in that stackoverflow thread to find the following solution:
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
Because Windows and various Windows utilities have their own SSH handling under the hood somewhere and most of that handling is done in very non-standard ways. Thought I would do a write-up to hopefully save some poor soul out there some time. Keep on trucking!