I have a script that is placed in a folder structure as such:
~/wofc/folder1/folder2/script.py
script.py uses the git module to go some tasks. However when I run the script from outside of folder2 i.e. when I have cd into folder1 i run python folder2/script.py arg1 arg2 I get the raise InvalidGitRepositoryError(epath) error. The script runs fine when I run it from inside folder2 i.e. cd into folder2 and run python script.py arg1 arg2. Below is the relevant code snippet. Can You please let me know what is the issue?
git = Repo('{}/..'.format(os.getcwd())).git
git.checkout('master')
git.pull()