Git не является внутренней или внешней командой исполняемой программой или пакетным файлом windows

The error ‘git’ is not recognized as an internal or external command happens when the system can’t find the Git program. This usually means Git isn’t installed, or its location isn’t added to the system’s PATH. This error indicates that the git command isn’t available in the terminal or command prompt.

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

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

The most common cause is not adding Git to the system’s PATH during installation. Also, if the command prompt was open during installation, it may need restarting to recognize Git.

In this article, we will discuss different ways to solve this error.

1. Re-Open Command Prompt

If you’ve installed Git but it’s not working in the command prompt, close and reopen it. The command prompt doesn’t update settings automatically while open, so reopening it loads the new Git path, making Git commands work.

2. Use the Git installation GUI to add the GIT path to Variables

Using the Git installation GUI to add Git to your system’s PATH allows Git commands to work in any terminal. Select “Use Git from the Windows Command Prompt” during installation to automatically set this up, avoiding manual setup and ensuring Git runs properly.

  1. Press Windows key + R, type “appwiz.cpl“, and press Enter to open Programs and Features.
  2. Find Git, right-click it, and select Uninstall. Follow the instructions to remove Git.
    Uninstall your current Git version
  3. Restart your computer.
  4. Visit this link to download the latest Git version for Windows. If it doesn’t start automatically, select your OS bit version.
    Downloading the Git installation executable

    Downloading the Git installation executable
  5. Run the installer, keep default settings, and ensure to select Use Git from Windows Command Prompt.
    Select Use Git from the Windows Command Prompt

    Select Use Git from the Windows Command Prompt
  6. Proceed with the installation and click Install.
    Installing Git for Windows

    Installing Git for Windows
  7. After installation, restart your computer to use Git commands in Windows Command Prompt.

3. Add the variable PATH manually

By Manually adding Git to the system’s PATH tells your computer where Git is installed, ensuring git commands work. This is needed if the PATH wasn’t set during installation or was removed. Add Git’s install folder to PATH, then restart the terminal to apply changes.

  1. Press Windows key + R, type “sysdm.cpl“, and press Enter to open the System Properties menu.
    Run dialog: sysdm.cpl

    Run dialog: sysdm.cpl
  2. Go to the Advanced tab and click on Environment Variables.
    Go to the Advanced tab and click on Environment Variables

    Go to the Advanced tab and click on Environment Variables
  3. In the Environment Variables menu, under System variables, select Path, then click Edit.
    Go to System Variables, select Path and click the Edit button

    Go to System Variables, select Path and click the Edit button
  4. In the Edit environment variables window, click New and add C:\Program Files\Git\cmd. Press Enter.
    Click on New and paste the git.exe's location

    Click on New and paste the git.exe’s location
  5. Click OK to save changes.
  6. Open a CMD window and type “git”.
    Git error is now resolved

    Git terminal error is now resolved

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Table of Contents

  1. Understanding the ‘git not recognized’ Error
    1. Possible Causes
  2. Let’s Fix It
    1. Solution 1: Install or Reinstall Git
    2. Solution 2: Manually Add Git to PATH
    3. Solution 3: Use System Repair Software

Understanding the ‘git not recognized’ Error

Encountering the ‘git is not recognized as an internal or external command’ error can be frustrating when trying to execute Git commands on your system. This error typically occurs when the Git executable is not found in your system’s PATH environment variable. The PATH variable is a list of directories where the operating system looks for executable files to run commands and programs. If Git is not in this list, your system will not know where to find the Git commands.

Possible Causes

  • Git is not installed on your system.
  • The Git executable path is not added to the PATH environment variable.
  • An incorrect path is set in the PATH variable for Git, perhaps due to a faulty installation or an update overriding settings.

Let’s Fix It

Solution 1: Install or Reinstall Git

Installation of Git is the primary step in setting up your system for Git commands.

  1. Download Git from the official Git website.
  2. Run the downloaded installer for Git.
  3. During installation, ensure that you choose the option to add Git to your system PATH.
  4. Complete the installation process and restart your computer.

Notes: Selecting the option to add Git to PATH during installation is crucial. This is usually the default option but should be confirmed for a successful installation. This method is easy and provides a fresh start, especially if the existing Git installation is corrupt.

Solution 2: Manually Add Git to PATH

If Git is already installed but not recognized, this usually means that Git’s path is not included in the PATH environment variable.

  1. Locate the Git executable file on your computer. By default, it’s often installed in C:\Program Files\Git\bin on Windows.
  2. Right-click on ‘My Computer’ or ‘This PC’ on your desktop or in File Explorer, and select ‘Properties’.
  3. Click on the ‘Advanced system settings’ link.
  4. In the System Properties window, click on ‘Environment Variables’.
  5. In the Environment Variables window, under the ‘System variables’ section, find and select the ‘Path’ variable and click ‘Edit’.
  6. Click the ‘New’ button and add the path to the Git executable (e.g., C:\Program Files\Git\bin).
  7. Click ‘OK’ to save the changes and close all the dialog boxes.
  8. Open a new command prompt window and type git --version to check if Git is now recognized.

The following output should confirm Git is recognized:

$ git --version $ git version 2.35.1.windows.2

Notes: This solution allows you to correct the PATH variable without needing to reinstall Git. However, it requires precision in finding the correct Git path and updating the PATH variable without introducing errors.

Solution 3: Use System Repair Software

System repair tools can automatically fix errors with environment variables and paths.

  1. Download and install a system repair tool that can fix path and environmental variables. (Be sure to choose software from a reputable source to avoid further complications.)
  2. Run the tool and select the option to scan and fix environment/path errors.
  3. Follow any additional instructions provided by the software to correct the PATH variable.
  4. Once completed, restart your computer, and try running Git commands again.

Notes: While system repair softwares can be effective at fixing various system issues inclusively environment variables, they might also adjust settings you are unaware of, leading to unexpected changes in your system’s configuration.

I’m guessing this has something to do with:

«git_command: a path to your git binary if it’s not in the $PATH available to Python (you’ll get an error message if you need to set this)», so I tried to followed the comment in git.sublime-settings

// if present, use this command instead of plain "git"
// e.g. "/Users/kemayo/bin/git" or "C:\bin\git.exe"

I use Windows 7, and as far as I know the git binary is located at

C:\Program Files (x86)\Git\bin\git.exe

I also followed your wiki to the point where I copy the Git.sublime-settings from the Git folder to the User folder, but seems neither «C:\bin\git.exe», or in my case «C:\Program Files (x86)\Git\bin\git.exe» gives a invalid escape error. I tried JSON escaping with \ but still get the same error when testing git commands:

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

Any ideas what I’m missing?

Привет, начал изучать git. Я установил его и в cmd.exe команда git —help работает, но в терминале vs code я получаю ошибку: «git» не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

Как это исправить?


  • Вопрос задан

  • 10116 просмотров

Ctrl+Shift+P
потом «Terminal: Select Default Profile«
ну и там есть «Git Bash«
Это если нужна командная строка.
А ещё есть вкладка Source Control

Изучайте :-)
Успехов!

Пригласить эксперта


  • Показать ещё
    Загружается…

Минуточку внимания

POCO, ACE, Loki и другие продвинутые C++ библиотеки

NullReferenced 13.05.2025

В C++ разработки существует такое обилие библиотек, что порой кажется, будто ты заблудился в дремучем лесу. И среди этого многообразия POCO (Portable Components) – как маяк для тех, кто ищет. . .

Паттерны проектирования GoF на C#

UnmanagedCoder 13.05.2025

Вы наверняка сталкивались с ситуациями, когда код разрастается до неприличных размеров, а его поддержка становится настоящим испытанием. Именно в такие моменты на помощь приходят паттерны Gang of. . .

Создаем CLI приложение на Python с Prompt Toolkit

py-thonny 13.05.2025

Современные командные интерфейсы давно перестали быть черно-белыми текстовыми программами, которые многие помнят по старым операционным системам. CLI сегодня – это мощные, интуитивные и даже. . .

Конвейеры ETL с Apache Airflow и Python

AI_Generated 13.05.2025

ETL-конвейеры – это набор процессов, отвечающих за извлечение данных из различных источников (Extract), их преобразование в нужный формат (Transform) и загрузку в целевое хранилище (Load). . . .

Выполнение асинхронных задач в Python с asyncio

py-thonny 12.05.2025

Современный мир программирования похож на оживлённый мегаполис – тысячи процессов одновременно требуют внимания, ресурсов и времени. В этих джунглях операций возникают ситуации, когда программа. . .

Работа с gRPC сервисами на C#

UnmanagedCoder 12.05.2025

gRPC (Google Remote Procedure Call) — открытый высокопроизводительный RPC-фреймворк, изначально разработанный компанией Google. Он отличается от традиционых REST-сервисов как минимум тем, что. . .

CQRS (Command Query Responsibility Segregation) на Java

Javaican 12.05.2025

CQRS — Command Query Responsibility Segregation, или разделение ответственности команд и запросов. Суть этого архитектурного паттерна проста: операции чтения данных (запросы) отделяются от операций. . .

Шаблоны и приёмы реализации DDD на C#

stackOverflow 12.05.2025

Когда я впервые погрузился в мир Domain-Driven Design, мне показалось, что это очередная модная методология, которая скоро канет в лету. Однако годы практики убедили меня в обратном. DDD — не просто. . .

Исследование рантаймов контейнеров Docker, containerd и rkt

Mr. Docker 11.05.2025

Когда мы говорим о контейнерных рантаймах, мы обсуждаем программные компоненты, отвечающие за исполнение контейнеризованных приложений. Это тот слой, который берет образ контейнера и превращает его в. . .

Micronaut и GraalVM — будущее микросервисов на Java?

Javaican 11.05.2025

Облачные вычисления безжалостно обнажили ахиллесову пяту Java — прожорливость к ресурсам и медлительный старт приложений. Традиционные фреймворки, годами радовавшие корпоративных разработчиков своей. . .

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Настройка калькулятора в windows
  • Kms auto windows 10 64 bit pro
  • Как отключить безопасность windows на windows 10 pro
  • Почему брандмауэр блокирует интернет windows 10
  • Проецировать на этот компьютер windows 11