git pull 提示无法找到 code 命令
·
在合并(pull)时遇到冲突,Git 试图调用 VS Code 作为合并工具,但VS Code 的路径写错了,或者你没有把 code 命令添加到环境变量中。
error: there was a problem with the editor '"D:\Programming\VS-Code\bin\code"' ...
No such file or directory
最快解决(不唤起编辑器,直接合并):在命令行中运行以下命令跳过 VS Code 编辑器:
git merge --continue
如果还是提示编辑器错误,你可以手动输入合并提交信息并完成合并:
git commit --no-edit
然后就可以推送了:
git push origin main
推荐:设置 Git 使用终端编辑器为 notepad(或其他你熟悉的编辑器):
git config --global core.editor notepad
如果你想以后能在命令行中直接用 code 打开 VS Code,你需要:
-
打开 VS Code;
-
按
Ctrl + Shift + P; -
输入并执行:
Shell Command: Install 'code' command in PATH; -
重启终端。然后就能通过
code .在任意目录打开 VS Code。
更多推荐
所有评论(0)