Skip to content

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

Description

@caserffer

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

Activity

  1. Byron commented on Mar 21, 2020

    @Byron
    Member

    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.

  2. reopened this on Feb 26, 2021
  3. locked and limited conversation to collaborators on Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions