[英]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. 从上一个VSCode版本开始,有一个弹出窗口询问我是否要允许Git打开。 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.
好吧,我允许这个,现在每当我尝试打开集成终端时,Git Shell会在外部打开并关闭集成终端。
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. 但它没有帮助,因为git已经在运行。
I want to open powershell instead and have git shell inside of VSCode as it was before. 我想打开powershell,并在VSCode中使用git shell,就像之前一样。 How can I achieve this?
我怎样才能做到这一点?
I run git config -l --show-origin
as VonC suggested: 我按照VonC的建议运行
git config -l --show-origin
:
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 user.email=some@email.com
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: 我的VScode用户设置:
"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: 使用
git
关键字的默认设置:
"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,
I think that this is more a git thing
我认为这更像是一个混蛋
Then uninstall Git for Windows if you did use the setup. 如果您使用了安装程序,请卸载Git for Windows。
For that, first, check (and move/delete) the various Git config files listed with: 为此,首先,检查(并移动/删除)列出的各种Git配置文件:
git config -l --show-origin
If this is from a Git setting, you could see it there. 如果这是来自Git设置,你可以在那里看到它。
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: 在另一个项目中,我可以完美地打开终端,所以我比较了这两个项目,发现有问题的项目有一个
.vscode
文件夹,里面有这个settings.json
:
{
"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. 这显然是由VSCode本身创建的,与使用GUI显示的用户配置文件无关。 Then I just commented out the git-bash line and started VSCode.
然后我只是注释掉git-bash行并启动了VSCode。 Since then I got rid of git auto starting in the terminal.
从那时起,我摆脱了终端中的git auto启动。 The annoying thing now is that I have to login to Github every time I load the project.
现在令人讨厌的是每次加载项目时我都必须登录Github。 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. 如果有人能够更好地解释那里发生了什么以及如何恢复github自动登录(不占用我的终端),我将接受一个好的答案。
Download and install git from https://git-scm.com/download/win 从https://git-scm.com/download/win下载并安装git
The default path for git should be C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe
git的默认路径应为
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! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.