-
-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posh Git Won't Show Status or Colors on Prompt (Win 7) #161
Comments
Hello, what do you see when you type "$Function:prompt" into the PowerShell terminal? This should return the contents of the function that is run to generate the prompt. The next thing to verify is that your profile contains a call to declare this function prompt. Type "notepad $profile" to view and edit the contents of this file. Also note that you actually have two profiles - one for when you run PowerShell from the terminal, and another for when you run ISE. Verify that your profile contains a call that looks something like the below: # Load posh-git example profile
. '<path to your git repo>\posh-git\profile.example.ps1' Also verify that the contents of the file shown above contain code like the following (you can customize this to suit your personal preference): Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current directory
Import-Module .\posh-git
# If module is installed in a default location ($env:PSModulePath),
# use this instead (see about_Modules for more information):
# Import-Module posh-git
# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
# Reset color, which can be messed up by Enable-GitColors
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
Write-Host($pwd.ProviderPath) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> "
}
Enable-GitColors
Pop-Location
Start-SshAgent -Quiet |
Also, do you see anything in |
Hey, sorry for the slow response. I'm at work now so can't test this out Max On Thu, Nov 13, 2014 at 8:41 AM, Keith Dahlby [email protected]
|
Hi, thanks again for reviewing this issue, and for maintaining poshgit! So, when I type $Error into powershell (shell not ISE), nothing outputs (just back to >). When I typed "$Function:prompt, I got the following response: .Linkhttp://go.microsoft.com/fwlink/?LinkID=225750.ExternalHelp System.Management.Automation.dll-help.xmlAnd finally, when I typed notepad $profile, a notepad file called PowerShell_profile.ps1 opened, but it was actually totally blank. So I should have to add text to that whenever I create a new git init? Or should poshgit update my powershell profile automatically? My execution policy is remote-signed, so I don't think I should be preventing undue changes to my profile in general. Should I re-install posh-git with an unrestricted execution policy? Thanks, |
Your prompt looks like posh-git isn't being loaded at all, which is what I would expect if your I would try running posh-git's |
I was having this issue also in powershell; Note my solution is almost identitcal to dahlbyk's. Although to allow certain git commands you need the line Additionally if your like me then you don't want the preceding *.* that is on the posh-git import line So, in C:\users\documents\ YOURUSERNAME \WindowsPowershell\ edit with notepad: Microsoft.PowerShell_profile1.ps1 Copy / Paste:
Save this file then restart powershell and you'll be good to go. |
(Posted this on Stack Overflow and got a suggestion to leave it here) -
http://stackoverflow.com/questions/26812896/posh-git-wont-show-status-or-colors-on-prompt?noredirect=1#comment42200920_26812896
I'm on Windows 7, installed git and then posh-git (to run git from powershell), no errors. I'm able to enter git commands like 'git init' and 'git status' now from the powershell, and posh-git's tab completion works in my powershell, so I believe means posh-git was installed successfully.
However, according to posh-git documentation, my powershell prompt should now provide 'git status' info with colors (like [master] when my directory has a .git file), but it doesn't. I ran $GitPromptSettings (which I found on posh-git's github readme) but "EnablePromptStatus" is True, and I don't see any other options in the GitPromptSettings that it looks like I should change to enable the prompt status.
My current directory in powershell has a .git folder in it, from a 'git init' command I entered in powershell, so I can't figure out why posh-git's PromptStatus feature isn't reflected in my powershell prompt.
The text was updated successfully, but these errors were encountered: