简体   繁体   中英

Github for Windows Git Shell (PowerShell) - How to “sync settings” across Git Shell and normal PowerShell

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.

Put your settings in a text file named .gitconfig located in your home directory (ie 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM