Git Bash commands are blocked by ransomware protection

903 views Asked by At

I've discovered that Git Bash commands are being blocked by Windows 10 Ransomware protection. This happens only if I am trying to execute them in Windows folders such as Documents. I've tested this with mkdir and touch but it probably involves more commands.

The error I am getting looks like this:

DESKTOP-FBRH45G MINGW64 ~/Documents/Git_Projects
$ mkdir example_folder
mkdir: cannot create directory ‘example_folder’: No such file or directory

This occurs when the protection of controlled folder access is turned on.

enter image description here

When the protection is turned off, the command is executed:

DESKTOP-FBRH45G MINGW64 ~/Documents/Git_Projects
$ mkdir example_folder

DESKTOP-FBRH45G MINGW64 ~/Documents/Git_Projects
$ ls
example_folder/

It doesn't make any difference if I run Git Bash with administrative rights. I've tried adding Git to allowed application settings but it does not make any difference either:

enter image description here

The only workaround is currently to disable the protection or move Git projects to another folder; however, I would like to know if there's anything I can do to make these commands work in my Documents folders as this is where I wanted to store the projects.

The current version of my git is:

DESKTOP-FBRH45G MINGW64 ~
$ git --version
git version 2.23.0.windows.1
1

There are 1 answers

0
seraph On

I was able to get Git functioning with ransomware protection, you need to literally exclude every .exe file in the Git directory where it is installed. You must also exclude mingw64\bin\git.exe.