Git integration for all your PowerShells with Github for Windows

We use git for our source control at work. In fact, we use Github. I have GitHub for Windows (GfW) installed because it's one of the easiest ways to install git on a Windows desktop. As part of the installation, you get to choose how the git shell is provided; I selected PowerShell (PS). This works well. You can access the integrated console via a separate shortcut or by the ~ key when viewing a repository in GfW.

However, the git integration (provided by posh-git) isn't available in the standard PS console nor PS ISE1. I use PS ISE a lot more these days as it gives me tabbed console windows and some cool features like auto-complete dropdowns2, so I wanted git integration there too.

As I already have git and posh-git installed via GfW, I didn't want to install both separately again just to get this support, I wanted to use what was already there.

To do this, open your PS or PS ISE console (you'll need to do this for both as they have separate profiles) and enter:

Then add the following lines and save:

To see the changes, you need to restart your console. If you're sure there'll be no nasty side-effects from running your profile twice in one session, you could also just enter:

And there you have it, git support using the GitHub for Windows installation in all your PowerShell windows.

  1. Integrated Scripting Environment 

  2. There are some caveats to using the ISE console tab over a regular PS console 

Leave a Reply

Your email address will not be published. Required fields are marked *