0

I have a Django app on an Apache server that uses subprocess.Popen to do a git pull on a repo stored on that server.

It manages to fetch the new commit for the server, but it can't do a checkout:

error: git checkout-index: unable to create file run_gui.py (Permission denied)

The exact same app works on my Windows system, being able to pull the git repo from the remote successfully. But on my Linux server it fails with the above error message. When I ssh into the server, I manage to do a git pull in the shell and it completes without error. But not from the Django app.

I thought that maybe this is a permissions issue; But I checked which user Django is running under, by using the same subprocess.Popen procedure to run id. I get my own user:

uid=608(coolrr) gid=608(coolrr) groups=608(coolrr)

This is the user that owns the repo.

I have also confirmed that I can create a simple file on the filesystem from the Django app.

Does anyone have an idea what's happening?

1 Answer 1

0

I found my mistake; I wasn't using the correct "working directory". This time I've given Popen a cwd argument, which I set to the path to my repo, and it worked without problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .