How can I use git bash aliases in vscode terminal?

user12783961

I have several git bash aliases that work fine when I use the git bash terminal, but they dont when I use the vscode integrated terminal? Is there a way to fix this? I do have bash selected in vscode.

After running git config -l --show-origin --show-scope

system  file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
system  file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
system  file:C:/Program Files/Git/etc/gitconfig credential.helper=manager
system  file:C:/Program Files/Git/etc/gitconfig core.editor=nano.exe
system  file:C:/Program Files/Git/etc/gitconfig core.autocrlf=true
system  file:C:/Program Files/Git/etc/gitconfig core.fscache=true
system  file:C:/Program Files/Git/etc/gitconfig core.symlinks=true
system  file:C:/Program Files/Git/etc/gitconfig diff.astextplain.textconv=astextplain
system  file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
system  file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f
system  file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process
system  file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
global  file:C:/Users/jgilr/.gitconfig  filter.lfs.smudge=git-lfs smudge -- %f
global  file:C:/Users/jgilr/.gitconfig  filter.lfs.process=git-lfs filter-process
VonC

Check how VSCode is launched.

Depending on your OS, it could be launched with a different account (or, on Windows, the "System" account), which means it would not benefit from the same "git config --global -l" settings, because its HOME environment variable is different from your bash.

In VSCode integrated terminal, assuming a recent Git, you can launch, to check if you see your aliases:

git config -l --show-origin --show-scope

The solution is:

  • add the aliases in %USERPROFILE%\.gitconfig
  • use the Shell argument -l (--login) for the setting "terminal.integrated.shellArgs.linux", as shown in issue 7263

https://camo.githubusercontent.com/4ee75b50a8a0476ba28f8b84291a46be7595997c/68747470733a2f2f636c6475702e636f6d2f366c515065614377634a2e706e67

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related