代码之家  ›  专栏  ›  技术社区  ›  Husna

在窗口10中安装git

  •  0
  • Husna  · 技术社区  · 7 年前

    我已经在我的电脑(windows10)中安装了git,并设置了环境变量path。

    但是在使用git下载WPCS时 git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs ,我得到以下错误

    'git' is not recognized as an internal or external command, operable program or batch file.

    Git目录路径是 C:\Program Files\Git 我将环境变量设置为 C:\Program Files\Git\cmd.

    有人能告诉我这里有什么问题吗?

    我也试过这些命令

    enter image description here

    3 回复  |  直到 5 年前
        1
  •  0
  •   Philippe    7 年前

    进程的环境变量(以及路径)(这里是 cmd.exe )在创建父进程时从父进程继承的。

    作为一种解决方法,您还可以打开任务管理器,终止并重新启动所有任务 explorer.exe

    然后所有由他创建的新进程都将具有良好的刷新值。 这应该可以工作(取决于您如何打开命令提示符;)

        2
  •  2
  •   Nghia Bui    7 年前

    Use Git from the Windows Command Prompt 安装时 git :

    enter image description here

    C:\Program Files\Git\cmd Path Windows的系统变量,请确保它在那里:

    enter image description here

    同时尝试关闭cmd窗口并打开它,甚至尝试重新启动你的电脑。

        3
  •  0
  •   camilo.forero    7 年前

    如果您已经安装了git-scm.com版本,您可以使用我的第二个最爱,git for Windows( https://gitforwindows.org

    它将支持您的Git安装开箱即用,而不必乱搞环境变量,并且它使用gitbash,它模拟一个常见的Linux命令行,因此您在web上找到的大多数Git命令都可以为您工作

    如果这样做,就不应该直接从Windows命令行运行git,而应该从gitbash命令行运行git,该命令行在Windows中的任何地方都可以通过右键单击菜单访问