Python git module Invalid git repository error
<p>I have a script that is placed in a folder structure as such:</p>

<p><code>~/wofc/folder1/folder2/script.py</code></p>

<p><code>script.py</code> uses the git module to go some tasks. However when I run the script from outside of <code>folder2</code> i.e. when I have <code>cd</code> into <code>folder1</code> i run <code>python folder2/script.py arg1 arg2</code> I get the <code>raise InvalidGitRepositoryError(epath)</code> error. The script runs fine when I run it from inside <code>folder2</code> i.e. <code>cd</code> into <code>folder2</code> and run <code>python script.py arg1 arg2</code>. Below is the relevant code snippet. Can You please let me know what is the issue?</p>

<pre><code>    git = Repo('{}/..'.format(os.getcwd())).git
    git.checkout('master')
    git.pull()
</code></pre>