3

GitPython depends on having the command line version of git installed (otherwise, you get the issue in this question: OSError: [Errno 2] No such file or directory on GitPython).

Is there any way from the GitPython API to check if the executable is found, or, do you need to wrap all GitPython calls in exception handling to account for this possibility?

1 Answer 1

1

I don't particularly recommend this, but I actually did it at least once: try one git command while catching the OSError case to see if you can run git (and by running it, capture the git version number as well, in my case). If git fails to run, complain and disable further invocations of git (or exit immediately or whatever). If not, assume further invocations will continue to work.

Sign up to request clarification or add additional context in comments.

2 Comments

is there some way to disable GitPython from going out to git.exe - or, you just mean that I should store a flag (in python ), indicating that git is not available?
I mean the latter (your own flag), yes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.