2

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

2 Answers2

2

Issue was fixed by adding terminal.integrated.shellArgs.windows": ["--login"] to vscode settings and writing all my aliases to %USERPROFILE%.bash_profile

0

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

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I updated this post with what I got after running the command –  Jul 02 '20 at 16:32
  • @jgil I don't see any alias in those settings: VSCode does not run with the same user as you do. Or those alaises were define inside a repository. – VonC Jul 02 '20 at 21:23
  • is there a way to change it? I put in all my aliases in ```"C:\Program Files\Git\etc\profile.d\aliases.sh"``` –  Jul 02 '20 at 21:27
  • 1
    @jgil Try putting those same aliases in `%USERPROFILE%\.gitconfig`, then relaunch VSCode. – VonC Jul 02 '20 at 21:28
  • I see, I got it to work, I had to add the aliases to ```%USERPROFILE%\.gitconfig``` and ```terminal.integrated.shellArgs.windows": ["--login"]``` to vscode settings –  Jul 02 '20 at 21:54
  • Note to self: That was my **24000th answer** on Stack Overflow (in 142 months), less than 6 months after the [23000th answer](https://stackoverflow.com/a/59853332/63099). Before that: [22000th answer](https://stackoverflow.com/a/57387243/6309), [21000th answer](https://stackoverflow.com/a/54856158/6309), [20000th answer](https://stackoverflow.com/a/51915541/6309), [19000th answer](https://stackoverflow.com/a/49421565/6309), [18000th answer](https://stackoverflow.com/a/46860745/6309), [17000th answer](https://stackoverflow.com/a/43703956/6309), ... – VonC Jul 03 '20 at 08:51