Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 908
Monu Kumar Avatar asked Mar 13 '18 12:03

Monu Kumar


People also ask

What is GIT SH setup?

The git sh-setup scriptlet is designed to be sourced (using . ) by other shell scripts to set up some variables pointing at the normal Git directories and a few helper shell functions.

What is SH in git?

DESCRIPTION. git-sh starts an interactive bash(1) session modified for git-heavy workflows. Typical usage is to change into the directory of a git work tree or bare repository and run the git-sh command to start an interactive shell session.


1 Answers

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 
like image 197
Pierre Arnaud Avatar answered Sep 20 '22 14:09

Pierre Arnaud