Wiring Up Posh Git Using GitHub for Windows Installation

Wiring Up Posh Git Using GitHub for Windows Installation

27 Mar, 2015

I have been using this method of wiring up posh git for a couple years now. And every time I have to setup a new box I have to go digging around to remember exactly how I set it up. So creating a post as a form of self documentation.

First, install GitHub for Windows. Best option use a boxstarterscript. Next best option, install it vai chocolatey with this command choco install githubforwindows. Worst case scenario, install it via the website.

Next, ensure you have a PowerShell profile by running this command Test-path $profile. If that command returns false, you don't have a profile. So, create one with this command New-item –type file –force $profile.

Finally, open your PowerShell profile with atom $profile and add the following script.

Now fire up a fresh PowerShell instance and check your install with git --version.

Not working? Did you forget to add Update-ExecutionPolicy RemoteSigned to your boxstarter script? Working at a draconian client that has some silly security forced on your dev box that won't allow boxstarter to work correctly? Throw a Set-ExecutionPolicy RemoteSigned at your administrator elevated PowerShell prompt.

Still not working? Sorry dude, better attack that with some google-fu.

Bonus: Want to be ultra hipster and use git-flow as well? We can do that.

First you need to download getopt.exe from the util-linux package; grab the binaries and dependencies zip files.

Next, open the binaries archive and copy getopt.exe in the bin directory to the bin directory located at $env:LOCALAPPDATA\GitHub\Portab~1. Also, open the dependencies archive and copy libintl3.dll and libiconv2.dll in the bin directory to the same location.