This was mostly an excuse to get better with PowerShell
For the sake of continuous learning — and so I could use a couple work-related
applications that don’t work even with WINE — I decided to spend more
time in Windows. Let’s see if I can comfortably use Git from
PowerShell. I’ll use the OpenSSH for Windows
server for key management, since it’s already available on my system.
Setting up Git
winget knows about several Git-related packages, so my installation command
needs to be specific.
The installation puts Git’s cmd folder onto $env:Path, but PowerShell
won’t see that until I refresh the variable.
And there it is!
I need to start a new session eventually, though. Can’t go around refreshing
my path like that every time I open a new terminal. Though I suppose I could
put this in PowerShell initialization.
Anyways, it looks like ssh-keygen is accessible via PowerShell.
I add an SSH key with the details from C:/Users/brian/.ssh/id_rsa.pub, and
check out a repo.
That was easy enough. There are a couple bits missing from my regular Git day,
Conveniences with posh-git
For starters, I enjoy a pretty shell prompt with version control details.
Let’s install the beta release of posh-git.
Lovely! I can customize it later.
Getting an SSH agent with posh-sshell
I dislike entering my ssh passphrase every time I interact with a version
control server. Need to get some sort of ssh-agent working.
Over in my PowerShell init, I make sure the new modules are loaded, set some
handy aliases for using my SSH keys, and start the SSH Agent.
Knowing me I’ll eventually generate this from my orgconfig.
After starting a new session, everything seems successful.
Did you see this bit?
That warning is a known issue with OpenSSH on Windows, and
should go away in the next month or two. The bad news: until it’s fixed,
different repository servers handle the mismatch differently. What I noticed
while working through the process that became this post:
Github issued the warning but let me continue
A server running Gitea issued the warning and would not let me continue
This is significant enough to highlight:
But other than that, things are working pretty good. Learning is fun!