Skip to content

git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[Errno 20] Not a directory') for 2.1.15 #1151

Answered by Byron
caserffer asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Hope that helps.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Byron
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #997 on February 26, 2021 11:18.