VSCode在终端中自动打开Git shell-如何禁用它?

VSCode在终端中自动打开Git shell-如何禁用它?,git,visual-studio-code,vscode-settings,git-shell,Git,Visual Studio Code,Vscode Settings,Git Shell,自从上一个VSCode版本以来,有一个弹出窗口询问我是否允许Git打开。我允许这样做,现在每次我尝试打开集成终端时,Git外壳都会从外部打开并关闭集成终端 我的用户配置: “terminal.integrated.shell.windows”:“C:\\windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe” 但这并没有帮助,因为git已经在运行了 我想改为打开powershell,并像以前一样将git shell放在VSCode中

自从上一个VSCode版本以来,有一个弹出窗口询问我是否允许Git打开。我允许这样做,现在每次我尝试打开集成终端时,Git外壳都会从外部打开并关闭集成终端

我的用户配置:

“terminal.integrated.shell.windows”:“C:\\windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe”

但这并没有帮助,因为git已经在运行了

我想改为打开powershell,并像以前一样将git shell放在VSCode中。我怎样才能做到这一点

更新: 我按照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
我的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",
{
[...]
"git.enabled": false,
"git.path": null,
"git.autofetch": false,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}
带有
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,
我认为这更像是一件蠢事

如果确实使用了安装程序,请卸载Git for Windows。
为此,首先检查(并移动/删除)列出的各种Git配置文件,包括:

git config -l --show-origin

如果这是来自Git设置,您可以在那里看到它。

我找到了导致此问题的原因,或者至少是部分原因。在另一个项目中,我可以完美地打开终端,因此我比较了这两个项目,发现有问题的项目有一个
.vscode
文件夹,里面有
设置.json

{
    "terminal.integrated.shell.windows": "D:\\TOOLS\\Git\\git-bash.exe",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
}
这显然是由VSCode本身创建的,与使用GUI显示的用户配置文件无关。然后我只是注释掉git bash行并启动VSCode。从那时起,我摆脱了git自动启动终端。现在令人恼火的是,每次加载项目时,我都必须登录Github。取消对行的注释并没有改变这种行为


如果有人能更好地解释那里发生了什么以及如何恢复github autologin(而不占用我的终端),我会接受一个好答案。

git的默认路径应该是
C:\\Program Files\\git\\bin\\bash.exe

然后转到文件首选项设置并在其他设置下添加此代码:

"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",
{
[...]
"git.enabled": false,
"git.path": null,
"git.autofetch": false,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}

希望这有帮助

@trebleCode抱歉,我知道这个医生-它对我的具体问题没有帮助。如果我调用集成终端,git会在外部弹出并关闭集成终端,因此我没有机会在那里更改某些内容。如果我退出git,当我打开vcode终端时,它仍然会自动打开;(哦,好的,对不起,我误解了。您是否尝试备份您的用户和工作区设置,并尝试从VSCode的“新”启动开始?@trebleCode是的,我刚刚做了,但行为相同;(我认为这更像是一个git问题……你能检查一下用户和工作区设置,看看在你允许git打开时定制了什么吗?谢谢,但卸载git似乎是摆脱所描述行为的一个重要步骤。我认为这是一个小问题,可以更简单地解决。我不明白起源列表可能会对我有所帮助。@Hexodus至少,请检查
git config-l--show origin
:其中可能有一个设置解释了您看到的内容。我按照建议做了,并用这些信息更新了我的帖子。到目前为止,我没有看到任何有用的东西-您呢?~反馈很好,比我的答案更准确。+1