Monu Kumar
Monu Kumar

Reputation: 933

How to fix "git-sh-setup: file not found" in windows?

I was using Git and it was working fine but after a restart, it shows the following error:

git-sh-setup: file not found

How to solve this issue?

Upvotes: 33

Views: 26026

Answers (4)

Muhammad Awais
Muhammad Awais

Reputation: 1966

weird solution, in my project package.json->scripts section this command was written "install:submodules": "git submodule update --init --recursive",

when I was using command npm run install:submodules I was facing this error

but when I directly used the command git submodule update --init --recursive it ran successfully.

Upvotes: 0

Pierre Arnaud
Pierre Arnaud

Reputation: 10517

I've run into this issue with the latest Git on Windows (v2.17.1.windows.2) and solved it both for cmd and PowerShell by adding two directories to PATH:

  • C:\Program Files\Git\usr\bin
  • C:\Program Files\Git\mingw64\libexec\git-core

enter image description here

From elevated powershell you could set it using:

$env:Path += ";c:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\libexec\git-core"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $env:Path

Upvotes: 69

Shadab Umer
Shadab Umer

Reputation: 313

I was having the same issue in the powershell, I just switched to git bash and ran the npm i then everything worked fine.

Upvotes: 3

If the above comment will not help try to open the powershell, or whatever you are using for terminal in administrator mode. In my case it helped.

Upvotes: 5

Related Questions