-
-
Notifications
You must be signed in to change notification settings - Fork 954
-
my code is
image
image
and my error is:
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:
image
is something wrong? i can run the same code on windows but failed on ubuntu!
help me tks
Beta Was this translation helpful? Give feedback.
All reactions
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
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
Along with GIT_PYTHON_GIT_EXECUTABLE
, I needed to export also GIT_SSH_COMMAND
. These worked for me. :-
export PATH=$PATH:/usr/bin/git export GIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git export GIT_SSH_COMMAND="/usr/bin/ssh -i ~/.ssh/id_rsa"
Beta Was this translation helpful? Give feedback.