You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[Errno 20] Not a directory') for 2.1.15 #997
Traceback (most recent call last):
File "PrecisionDiff.py", line 250, in <module>
obj.pares_from_git_log()
File "PrecisionDiff.py", line 74, in pares_from_git_log
self.REPO_EXECUTE.execute("git checkout master")
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 738, in execute
raise GitCommandNotFound(command, err)
git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[Errno 20] Not a directory')
cmdline: git checkout master
my git cmd run ok:
is something wrong? i can run the same code on windows but failed on ubuntu!
GitPython tries very hard to find a suitable git executable on the system it is executed on, and I could imagine that this for some reason fails.
Before starting your program, or before importing GitPython, you can set the GIT_PYTHON_GIT_EXECUTABLE to the executable to use, like in GIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git python myscript.py. That will force GitPython to use the specified executable, which usually works.
Activity
Byron commentedon Mar 21, 2020
GitPython tries very hard to find a suitable git executable on the system it is executed on, and I could imagine that this for some reason fails.
Before starting your program, or before importing GitPython, you can set the
GIT_PYTHON_GIT_EXECUTABLEto the executable to use, like inGIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git python myscript.py. That will force GitPython to use the specified executable, which usually works.Hope that helps.