I am trying to perform a git pull operation when a django view is called inside the view.
cmd = 'cd %s && git pull origin master' % dir_path
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
stdout, stderr = process.communicate()
I get below error in stderr:
fatal: unsafe repository ('/home/user/my_dir' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /home/user/my_dir
I believe it is ownership related issue but not sure about the solution. Command runs just fine when I run it from shell. It is currently running from django runserver.
I have tried adding this directory to safe.directories
git config --global --add safe.directory /home/user/my_dir
but still see the same error