I am trying to run git commands through a python subprocess. I do this by calling git.exe in the cmd github directory.
I managed to get most of the commands to work (init, remote, status), but I get an error when calling git add. This is my code:
import subprocess gitPath = 'C:/path/to/git/cmd.exe' repoPath = 'C:/path/to/my/repo' repoUrl = 'https://www.github.com/login/repo';
The error I am getting is:
fatal: Not a git repository (or any of the parent directories): .git
So, I was looking for this error, and most of the solutions I found were not in the correct directory. So I assumed that it is. However, I do not know why. git status returns the correct files in the directory, and I installed - git -dir and -work-tree
If I go to the git shell, I have no problem adding files, but I canβt find out why something is wrong here.
I am not looking for a solution using the pythons git library.
source share