You have to do dos2unix first like Etan mentioned. I can regenerate the same error if I do the reverse (i.e. unix2dos)
$ cat 1.sh
#!/bin/bash
git pull
echo ----
$ ./1.sh
fatal: Not a git repository (or any parent up to mount parent /cygdrive)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
----
See above, git pull command worked but with a valid error message that no repo mentioned after pull as im doing first time. That means git exists (if you do which git you'll see valid git executable location).
$ unix2dos.exe ./1.sh
unix2dos: converting file ./1.sh to DOS format ...
Now, my file is in DOS format (and Im running the script in Linux machine). Are you using Cygwin?
$ ./1.sh
./1.sh: line 2: $'\r': command not found
' is not a git command. See 'git --help'.
Did you mean this?
pull
----
OK, convert it back to Unix line ending chars using dos2unix
$ dos2unix.exe ./1.sh
dos2unix: converting file ./1.sh to Unix format ...
$ ./1.sh
fatal: Not a git repository (or any parent up to mount parent /cygdrive)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
----
It works as expected.
OR try running with bash -x
dos2unixon that script help?git pull\r.