从上一个VSCode版本开始,有一个弹出窗口询问我是否要允许Git打开 . 好吧,我允许这个,现在每当我尝试打开集成终端时,Git Shell会在外部打开并关闭集成终端 .
我的用户配置:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
但它没有帮助,因为git已经在运行 .
我想打开powershell,并在VSCode中使用git shell,就像之前一样 . 我怎样才能做到这一点?
更新:
我按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
关键字的默认设置:
"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,
3 Answers
如果您使用了安装程序,请卸载Git for Windows .
为此,首先,检查(并移动/删除)列出的各种Git配置文件:
如果这是来自Git设置,你可以在那里看到它 .
我弄清楚是什么导致了这个问题或至少是其中的一部分 . 在另一个项目中,我可以完美地打开终端,所以我对这两个项目进行了比较,发现有问题的那个项目里面有一个
.vscode
文件夹,里面有这个settings.json
:这显然是由VSCode本身创建的,与使用GUI显示的用户配置文件无关 . 然后我只是注释掉git-bash行并启动了VSCode . 从那时起,我摆脱了终端中的git auto启动 . 现在令人讨厌的是每次加载项目时我都必须登录Github . 取消注释该行并未改变该行为 .
如果有人能够更好地解释那里发生了什么以及如何恢复github自动登录(不占用我的终端),我将接受一个好的答案 .
从https://git-scm.com/download/win下载并安装git
git的默认路径应为
C:\\Program Files\\Git\\bin\\bash.exe
然后转到 File > Preferences > Settings 并在您的其他设置下添加此代码:
希望这可以帮助!