I use Github for Windows and usually I use the "Open a Shell" here command which launches powershell with some custom settings. It makes powershell display extra information when I'm inside a Git repo like the status of the Repo just before the prompt, having a black background...

However when I use the normal powershell, all those niceties are gone. I would like those changes on the powershell to become the default so that I wouldn't have to launch the custom prompt.

I was wondering if its possible to get those settings at runtime and then apply it permanently. I have been able to make powershell have a black background by default and change the default font but I can't get those extra info on git repositories.



There are a few different default places the Powershell profile can be stored. This is where your custom code should be stored, so that every time you open up a new Powershell prompt it applies these settings.

The first location is the global location and would be useful when you want all users to have a customized Powershell profile. This profile should be placed in C:\WINDOWS\system32\WindowsPowerShell\v1.0\Profile.ps1.

The second location is for the local profile and would be specific to each user account. This file overrides the global configuration file and should be placed in C:\Username\My Documents\WindowsPowerShell\Profile.ps1.

As for getting your git stuff working, there are some good blog posts here and here that go over how to customize the profile to make git work better and look pretty. Select the parts of their code/configuration to your own profile to get your git settings up and working the way you want.

  • Thanks.. The second post was exactly what I needed. Turns out Phil Haack is the guy who developed Git for Windows. Thanks a bunch
    – Ody
    Apr 13 '13 at 6:34
  • Glad to hear it works :)
    – jmreicha
    Apr 13 '13 at 13:05

GitHub for Windows uses Posh-Git. You should get it from GitHub (https://github.com/dahlbyk/posh-git) and add it to your regular profile, which lives at $PROFILE, using something like:

git clone https://github.com/dahlbyk/posh-git ~\GitHub\posh-git
'Import-Module ~\GitHub\posh-git\posh-git' >> $PROFILE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.