【问题标题】:Windows 10 cannot recognize GitWindows 10 无法识别 Git
【发布时间】:2019-06-15 00:25:11
【问题描述】:

我在笔记本电脑上安装了 Windows 10 x64,然后也安装了最新的 Git (Git-2.6.3-64-bit)。正如我在笔记本电脑上看到的,Git 现在安装在这个目录中:C:\Users\MyPC\AppData\Local\Programs\Git(我没有机会指定另一个特定的文件夹,因为它是在 Git 安装期间自动完成的)。 “Use Git from the Windows Command Prompt”和“Use OpenSSH”选项已被选中,Windows 路径已更新为 Git 目录。毕竟,问题在于,Windows 无法识别 Git 要调用的位置。我试过 git --version 但它无法被 Windows 识别。

我的问题是(在 Windows 10 Pro x64 上):
1.Git可以指定另一个安装文件夹吗?
2. 在Git dir/bin 中,没有ssh.exe,而在OpenSSH 选择对话框中,它告诉我“这使用了Git 自带的ssh.exe”。那么,内置的 SSH 客户端在哪里呢?
3. 我怀疑现在 Windows 10 不接受安装在 %USERPROFILE%/AppData 上的任何外部程序包含到系统路径中。对吗?
4、如何让Windows“看到”Git?

【问题讨论】:

  • 确保 git.exe 位于您添加到路径的文件夹中
  • 在 Windows 10 上更新到适用于 windows 2.6.3 的 git 后,我​​遇到了同样的问题。git 安装在 C:\Users\MyPC\AppData\Local\Programs\Git 而不是 C:\Program Files\Git
    问题是 git 仍然尝试访问 C:\Program Files\Git 文件夹中的内容:
     C:\projects\test>git clone github.com/foo/bar 克隆到 'bar'... 致命:无法访问 'github.com/foo/bar .git/';:错误设置证书验证位置:CAfile:C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt CApath:无

标签: windows git ssh


【解决方案1】:

刚刚自己解决了这个问题,这是一段非常令人沮丧的旅程,但对我来说,以下是我前进的动力:

  1. 确保 c:\Windows\System32\OpenSSH\ 在您的路径变量中(是的,我知道 Windows 应该自己看到这个)
  2. 转到 C:\Users\.gitconfig 编辑全局 git 配置文件以指向正确的 ssh.exe 'C:/Windows/System32/OpenSSH
  3. 确保您的 id_rsa.ppk 文件位于 C:\Users\.ssh 如果您还没有 SSH 密钥,请生成一个并确保它最终位于此文件夹中
  4. 您可能还想检查您的 OpenSSH 身份验证代理是否已在 Windows 服务中启动

【讨论】:

    【解决方案2】:
    1. 我们可以为 Git 指定另一个安装文件夹吗?

    尝试以管理员身份运行安装程序,以便将其安装到 Program Files。我不确定如何指定自定义路径。

    1. 在 Git 目录/bin 中,没有 ssh.exe,而在 OpenSSH 选择对话框中,它告诉我“这使用 Git 附带的 ssh.exe”。那么,内置的 SSH 客户端在哪里?

    一些挖掘告诉我它可能存在于 Git 安装中的 .ssh 文件夹中,所以 C:\Users\MyPC\AppData\Local\Programs\Git\.ssh

    1. 我怀疑现在 Windows 10 不接受安装在 %USERPROFILE%/AppData 上的任何外部程序包含到系统路径中。对吗?

    AFAIK,您可以将任何目录添加到您的路径中。

    1. 如何让 Windows “看到” Git?

    C:\Users\MyPC\AppData\Local\Programs\Git 添加到您的路径:

    Start the System Control Panel applet (Start - Settings - Control Panel - System).
    Select the Advanced tab.
    Click the Environment Variables button.
    Under System Variables, select Path, then click Edit.
    You'll see a list of folders, as this example for my system shows: C:\Program Files\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Intel\DMIX;C:\Program Files\Executive Software\Diskeeper\;C:\Program Files\Bonjour\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Misc
    You can add additional folders that you want to include in searches. I add a "C:\program files\misc" entry into which I place my standalone utilities, instead of copying them into C:\windows. Click OK.
    You'll need to restart the processes (e.g., command prompt) that use the system path to see the added folders.
    

    来自http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path

    【讨论】:

    • 感谢@Pablo 的解释。检查笔记本电脑的状态后,我看到: 1. Git 安装中没有.ssh 文件夹 2. 我尝试将一些可执行文件放到%USERPROFILE%/AppData 中,但它仍然无法被 Windows 3 识别。我已将 Git 路径添加到系统变量,但仍然无法正常工作。
    • 1. “尝试以管理员身份安装 Git”并不能解决问题,我很害怕。
    猜你喜欢
    • 2016-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-19
    • 1970-01-01
    • 2021-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多