You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git在Bash中正常运行但VSCode中多数功能失效的问题排查

VSCode中Git仅能暂存无法提交/拉取/推送的解决办法

以下是几个针对性的排查和修复步骤:

  • 重置VSCode的Git配置
    打开VSCode设置面板(快捷键Ctrl+,),搜索git.path,确认路径和日志里的C:\Program Files\Git\cmd\git.exe一致。接着按下Ctrl+Shift+P,输入Git: Reset Git Settings执行,之后重启VSCode测试。

  • 检查Git凭证管理器配置
    因为Git Bash能正常操作,大概率是VSCode的凭证获取出了问题。打开Git Bash,执行git config --global credential.helper,如果结果是manager-core,可以重新配置一遍:git config --global credential.helper manager-core,完成后重启VSCode。

  • 排查冲突扩展
    部分第三方扩展可能干扰Git功能,先暂时禁用所有非官方扩展,重启VSCode看是否恢复正常,再逐个启用扩展排查问题源。

  • 重装VSCode的Git扩展
    打开扩展面板,找到内置的Git扩展,点击卸载后重新安装,重启VSCode即可。

提交操作时的控制台日志

2023-03-24 22:52:04.641 [info] Log level: Info
2023-03-24 22:52:04.641 [info] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2023-03-24 22:52:04.641 [info] Using git "2.40.0.windows.1" from "C:\Program Files\Git\cmd\git.exe"
2023-03-24 22:52:04.712 [info] > git rev-parse --show-toplevel [72ms]
2023-03-24 22:52:04.859 [info] > git rev-parse --git-dir --git-common-dir [80ms]
2023-03-24 22:52:04.873 [info] Open repository: c:\Users\costa\Documents\KiteMeUp-react
2023-03-24 22:52:04.949 [info] > git rev-parse --show-toplevel [67ms]
2023-03-24 22:52:04.971 [info] > git config --get commit.template [64ms]
2023-03-24 22:52:04.988 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [67ms]
2023-03-24 22:52:05.012 [info] > git rev-parse --show-toplevel [56ms]
2023-03-24 22:52:05.076 [info] > git status -z -uall [80ms]
2023-03-24 22:52:05.086 [info] > git rev-parse --show-toplevel [68ms]
2023-03-24 22:52:05.143 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z -n184 -- c:\Users\costa\Documents\KiteMeUp-react\index.html [70ms]
2023-03-24 22:52:05.175 [info] > git config --get commit.template [74ms]
2023-03-24 22:52:05.177 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [67ms]
2023-03-24 22:52:05.184 [info] > git rev-parse --show-toplevel [93ms]
2023-03-24 22:52:05.243 [info] > git status -z -uall [59ms]
2023-03-24 22:52:05.442 [info] > git rev-list --count 2174a3a7f2d7bfe11614905b59a2e929e358b438.. -- c:\Users\costa\Documents\KiteMeUp-react\index.html [57ms]
2023-03-24 22:52:05.519 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z -n7 -- c:\Users\costa\Documents\KiteMeUp-react\index.html [69ms]
2023-03-24 22:52:05.549 [info] > git check-ignore -v -z --stdin [55ms]
2023-03-24 22:52:05.707 [info] > git show --textconv :index.html [65ms]
2023-03-24 22:52:05.715 [info] > git ls-files --stage -- C:\Users\costa\Documents\KiteMeUp-react\index.html [64ms]
2023-03-24 22:52:05.774 [info] > git cat-file -s 1290a2cbf506e5218326298008f4567bd76cade7 [52ms]
2023-03-24 22:52:07.927 [info] > git check-ignore -v -z --stdin [50ms]
2023-03-24 22:52:13.417 [info] > git add -A -- C:\Users\costa\Documents\KiteMeUp-react\.github\workflows\install_dependencies.yml C:\Users\costa\Documents\KiteMeUp-react\index.html C:\Users\costa\Documents\KiteMeUp-react\src\doc\Doc [65ms]
2023-03-24 22:52:13.473 [info] > git config --get commit.template [49ms]
2023-03-24 22:52:13.480 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [50ms]
2023-03-24 22:52:13.540 [info] > git status -z -uall [54ms]
2023-03-24 22:52:14.657 [info] > git ls-files --stage -- C:\Users\costa\Documents\KiteMeUp-react\index.html [50ms]
2023-03-24 22:52:14.711 [info] > git cat-file -s 899fc10ccd507b744402ac3f3499effbdf6224d9 [49ms]
2023-03-24 22:52:14.770 [info] > git show --textconv :index.html [51ms]
2023-03-24 22:52:15.614 [info] > git show --textconv :.git/COMMIT_EDITMSG [52ms]
2023-03-24 22:52:15.620 [info] > git ls-files --stage -- C:\Users\costa\Documents\KiteMeUp-react\.git\COMMIT_EDITMSG [52ms]
2023-03-24 22:52:15.934 [info] > git check-ignore -v -z --stdin [52ms]
2023-03-24 22:52:16.441 [info] > git ls-files --stage -- C:\Users\costa\Documents\KiteMeUp-react\index.html [51ms]
2023-03-24 22:52:16.448 [info] > git ls-files --stage -- C:\Users\costa\Documents\KiteMeUp-react\.git\COMMIT_EDITMSG [49ms]
2023-03-24 22:52:16.494 [info] > git cat-file -s 899fc10ccd507b744402ac3f3499effbdf6224d9 [48ms]
2023-03-24 22:52:16.504 [info] > git show --textconv :.git/COMMIT_EDITMSG [48ms]
2023-03-24 22:52:16.553 [info] > git show --textconv :index.html [51ms]

内容的提问来源于stack exchange,提问作者Andrea Costanzo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 17:14:53