2

I'm having some trouble getting my normal PowerShell to work exactly like the one that comes with GitHub for Windows. I have posh-git working using something like this (shown below) in my PS profile and I can in fact use Git, but there are some things that I'm noticing are different when using the two.

# Load github shell and posh-git example profile
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
. (Resolve-Path "$env:github_posh_git\profile.example.ps1")

In particular, the configurations are different between the two. If I enter git config --list I can see that there are way more in the Git Shell from GfW. I came across this by trying to use git difftool and it wasn't working (in Git Shell it'll use VS2013). Below are some things from the list of both.

Git Shell (GitHub for Windows):

> git config --list
alias.c=commit
alias.co=checkout
alias.dt=difftool
alias.mt=mergetool
alias.praise=blame
alias.ff=merge --ff-only
alias.st=status
alias.sync=!git pull && git push
apply.whitespace=nowarn
core.symlinks=false
core.autocrlf=true
core.editor=gitpad
core.preloadindex=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
color.ui=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle-ghfw.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=!github --credentials
filter.ghcleansmudge.clean=cat
filter.ghcleansmudge.smudge=cat
push.default=upstream
diff.tool=vs2013
diff.algorithm=histogram
difftool.prompt=false
difftool.bc4.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe" "$LOCAL" "$REMOTE"
difftool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"
difftool.vs2012.cmd="c:/program files (x86)/microsoft visual studio 11.0/common7/ide/devenv.exe" '//diff' "$LOCAL"
"$REMOTE"
difftool.vs2013.cmd="c:/program files (x86)/microsoft visual studio 12.0/common7/ide/devenv.exe" '//diff' "$LOCAL"
"$REMOTE"
merge.tool=bc3
mergetool.prompt=false
mergetool.keepbackup=false
.......

Normal PowerShell:

> git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=Jordan Harris
user.email=****************
filter.lfs.clean=git lfs clean %f
filter.lfs.smudge=git lfs smudge %f
filter.lfs.required=true
gui.recentrepo=C:/Users/Jordan/SkyDrive/Documents/JUCE/Projects/CustomKnob2
core.editor=atom --wait
core.autocrlf=false

I'm really wanting to use PowerShell in Console2 (or ConsoleZ), so it would be really great to have the same configuration between both PowerShells. The reason I'm using the normal Powershell is because I can't get the Git Shell to work in Console2. I'd be fine with just using that if anyone knows how to make it work with Console2. I would really appreciate any help from y'all.

Note: When I say "Git Shell", I mean the shortcut that says Git Shell that comes with GitHub for Windows. It's the same as opening it from the GfW app.

Jordan Harris
  • 380
  • 2
  • 7

1 Answers1

0

Put your settings in a text file named .gitconfig located in your home directory (i.e. C:\Users\username).

That's the second widest scope of settings, which are going to be applied to all repositories for the current user, regardless of the client application being used.

You can modify those settings by passing the --global switch to git config. For example:

git config --global core.autocrlf false
Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154
  • Thanks for the reply. So how exactly would I get all of those settings and put them in the .gitconfig file? Also, where are the config settings for the Git Shell from GutHub for Windows? I've already set some things in that .gitconfig file, like my name and text editor, but I have no idea what Git Shell is using. – Jordan Harris May 18 '15 at 10:35
  • The easiest way would be to manually copy the settings from the config file created by GitHub for Windows and put them in the global `.gitconfig` file. You'll find those settings in `%LocalAppData%\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\etc\gitconfig` – Enrico Campidoglio May 18 '15 at 10:47
  • Thank you so much! That did the trick. :) I was stressing about this all night. Lol. That's awesome to get a solution so fast after posting. This is my first post here so I'm surprised. Now I can work with git in PowerShell from within Console2/ConsoleZ like before. Now back to learning Git. :) – Jordan Harris May 18 '15 at 11:22
  • I wonder if I can make the normal PowerShell use the Git version that came with GitHub for Windows and if that'll make it use those configurations. I have another Git download and I'm thinking it might be using that one. I'm really not sure though because I just followed some instructions from a few sites and I don't remember if I set it to use that Git download. Do you know anything about that? I should probably just delete the extra one and keep the one that came with GitHub for Windows. – Jordan Harris May 18 '15 at 11:38
  • If you want to use the version of Git that comes bundled with GitHub for Windows, you can simply add `%LocalAppData%\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin`​ to your `%PATH%` and it will work from any console. However, I would install Git through [Chocolatey](https://chocolatey.org/) instead, since it will make it easier to keep it updated going forward. – Enrico Campidoglio May 18 '15 at 11:45
  • I'll have to check out Chocolately. How exactly do I add that to my path? Sorry, I'm completely new to using using a command line. I have to say I'm really liking it though. I really like how I can customize PowerShell. – Jordan Harris May 18 '15 at 14:17
  • You can modify your path through a dialog box from the [Advanced System Settings](http://stackoverflow.com/a/4855685/26396) or run this from the command line: `setx Path "%Path%;%LocalAppData%\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin"` – Enrico Campidoglio May 19 '15 at 08:10