Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.