【问题标题】:How to detect git on VSCode without administrator right如何在没有管理员权限的情况下检测 VSCode 上的 git
【发布时间】:2020-02-13 00:08:06
【问题描述】:

当我尝试在没有管理员权限的情况下启动 Visual Studio Code 时,我收到类似“您的系统上似乎没有安装 git”的 VSCode 报告。

我从https://git-scm.com/安装了git(2.23.0)

来自https://code.visualstudio.com/的Visual Studio Code (1.39.2)

当我以管理员权限启动 VSCode 时,git 被正确检测到。

我尝试在 Windows 环境 PATH + 重启 PC 上添加 git 路径 -> 无效。

我尝试在 VSCode setting.json 上添加 git 路径 + 重启,如:

{
    // Is git enabled
    "git.enabled": true,

    // Path to the git executable
    "git.path": "C:\\path\\to\\git.exe"

    // other settings
} 

--> 那也没用。

如果我使用“显示 Git 输出”,报告会显示正确的路径,但不会检测到 git 安装。

【问题讨论】:

    标签: git visual-studio-code administrator


    【解决方案1】:

    最后,我找到了解决问题的方法。当我默认安装 VS 代码时,正在“C:\users[user]\AppData\vscode”。而git默认安装文件夹是“C:\Program Files\Git\”

    当我尝试从 vscode 调用 git 函数时,它来自我的用户目录,并且禁止访问 git。

    解决方案:我在我的用户目录上安装了 git,现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 2011-05-16
      • 2021-08-25
      • 2014-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多