Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode automatically opens Git shell in terminal - how to disable it?

Since last VSCode version there was a popup asking me if I want to allow Git to open. Well I allowed this and now every time I try to open the integrated terminal the Git Shell opens externally and closes the integrated terminal.

My user config:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"

But it doesn't help because git is already running.

I want to open powershell instead and have git shell inside of VSCode as it was before. How can I achieve this?

UPDATE:

I run git config -l --show-origin as VonC suggested:

file:"C:\\ProgramData/Git/config"       core.symlinks=false
file:"C:\\ProgramData/Git/config"       core.autocrlf=true
file:"C:\\ProgramData/Git/config"       core.fscache=true
file:"C:\\ProgramData/Git/config"       color.diff=auto
file:"C:\\ProgramData/Git/config"       color.status=auto
file:"C:\\ProgramData/Git/config"       color.branch=auto
file:"C:\\ProgramData/Git/config"       color.interactive=true
file:"C:\\ProgramData/Git/config"       help.format=html
file:"C:\\ProgramData/Git/config"       http.sslcainfo=D:/TOOLS/Git/mingw64/ssl/certs/ca-bundle.crt
file:"C:\\ProgramData/Git/config"       diff.astextplain.textconv=astextplain
file:"C:\\ProgramData/Git/config"       rebase.autosquash=true
file:"D:\\TOOLS\\Git\\mingw64/etc/gitconfig"    credential.helper=manager
file:C:/Users/myusername/.gitconfig  filter.lfs.clean=git-lfs clean -- %f
file:C:/Users/myusername/.gitconfig  filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Users/myusername/.gitconfig  filter.lfs.process=git-lfs filter-process
file:C:/Users/myusername/.gitconfig  filter.lfs.required=true
file:C:/Users/myusername/.gitconfig  user.name=MYName
file:C:/Users/myusername/.gitconfig  [email protected]
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=false
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false
file:.git/config        core.ignorecase=true
file:.git/config        remote.origin.url=https://github.com/MyProject/my-project.git
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.master.remote=origin
file:.git/config        branch.master.merge=refs/heads/master
file:.git/config        branch.routing.remote=origin
file:.git/config        branch.routing.merge=refs/heads/routing

My VScode user settings:

"php.validate.executablePath": "D:/TOOLS/xampp7/php/php.exe",
"php.suggest.basic": false,
"window.zoomLevel": 0,
"workbench.colorTheme": "Monokai",
"workbench.iconTheme": "vs-seti",
"git.path": "D:/TOOLS/Git/cmd/git.exe",
// A glob pattern that defines files and folders to exclude while listing annotations
  "todohighlight.exclude": "{**/node_modules/**,**/bower_components/**,**/bower/**,**/libs/**,**/vendor/**,**/dist/**,**/build/**,**/.vscode/**,**/_output/**,**/*.min.*,**/*.map}",
  "git.autofetch": true,
  "git.confirmSync": false,
  "git.enableSmartCommit": true,
  "explorer.confirmDelete": false,
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
  "todo.colors.tag": "#967848",
  "todo.colors.code": "#fbf5cb",

Default settings with the git keyword:

  "projectManager.git.baseFolders": [],
  "projectManager.git.maxDepthRecursion": 4,
  "git.autofetch": false,
  "git.autorefresh": true,
  "git.checkoutType": "all",
  "git.confirmSync": true,
  "git.countBadge": "all",
  "git.decorations.enabled": true,
  "git.defaultCloneDirectory": null,
  "git.enableCommitSigning": false,
  "git.enabled": true,
  "git.enableSmartCommit": false,
  "git.ignoreLegacyWarning": false,
  "git.ignoreLimitWarning": false,
  "git.ignoreMissingGitWarning": false,
  "git.path": null,
like image 378
Hexodus Avatar asked Jan 24 '18 13:01

Hexodus


People also ask

How to configure Git Bash as default Integrated Terminal in VSCode?

To configure Git Bash as the default integrated terminal in VSCode version 1.56 on Windows 10. Step 1: Open command palette (CMD + Shift + P) Step 2: Search "Preferences: Open User Settings (JSON)" Step 3: Create a new field by typing "" (double quotation key). Inside the quotation type "terminal."

How do I Turn Off Git integration in Visual Studio Code?

Disable The Git Integration In Visual Studio Code. Disable the Git integration is quite easy. On MacOS, open the User Settings here Code > Preferences > User settings or by using the keyboard shortcut ⌘,. The Default Settings will open on the left and the User Settings on the right.

Is there a command to skip the shell in VS Code?

There is a hardcoded list of commands, which skip being processed by the shell and instead get sent to the VS Code keybinding system. Customize this list with the terminal.integrated.commandsToSkipShell setting.

Why can't I launch VS Code from terminal?

Some terminal launch failures may be due to your shell installation and are not specific to VS Code. The error codes displayed come from the shell and you may be able to diagnose shell issues by searching on the internet for the specific shell and error code. Use the most recent version of VS Code.


3 Answers

I think that this is more a git thing

Then uninstall Git for Windows if you did use the setup.
For that, first, check (and move/delete) the various Git config files listed with:

git config -l --show-origin

If this is from a Git setting, you could see it there.

like image 114
VonC Avatar answered Oct 16 '22 10:10

VonC


I figured out what's causing this problem or at least a part of it. In an another project I could perfectly open the terminal so I compared these two projects and found out that the one with the problem has a .vscode folder with this settings.json inside:

{
    "terminal.integrated.shell.windows": "D:\\TOOLS\\Git\\git-bash.exe",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
}

Well this has been obviously created by VSCode itself and has nothing to do with the user config file that shows up using the GUI. Then I just commented out the git-bash line and started VSCode. Since then I got rid of git auto starting in the terminal. The annoying thing now is that I have to login to Github every time I load the project. Uncommenting the line didn't change that behavior.

If someone can explain better what's happening there and how to restore the github autologin (without occupying my terminal) I will sill accept a good answer.

like image 27
Hexodus Avatar answered Oct 16 '22 11:10

Hexodus


Download and install git from https://git-scm.com/download/win

The default path for git should be C:\\Program Files\\Git\\bin\\bash.exe

Then go to File > Preferences > Settings and add this code under your other settings:

{
[...]
"git.enabled": false,
"git.path": null,
"git.autofetch": false,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}

Hope this helps!

like image 1
Andreas Sterner Avatar answered Oct 16 '22 11:10

Andreas Sterner