I am trying to execute a simple git command using the following python script.
import commands
import subprocess
import os
import sys
pr = subprocess.Popen( "/usr/bin/git log" , cwd = os.path.dirname( '/ext/home/rakesh.kumar/workspace/myproject' ), shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
(out, error) = pr.communicate()
print "Error : " + str(error)
print "out : " + str(out)
but I get the following error even if I run the python script in the same directory where there is git reposetory.
Error : fatal: Not a git repository (or any of the parent directories): .git
I suspected that git might be corrected, but git files are great, and git commands work if I run on a regular command line.
I tried to search the net but could not get useful information. Please help, he will be very grateful.
source
share