0

I've written a program that clones and pulls lots of git repos (to try to estimate time spent on projects) and also serves as a website to present data. The program is written in C# on using Visual Studio for Mac and runs fine locally, but I'm having trouble when deployed onto an Ubuntu 16.0.4 machine.

The program runs as the www-data user. It needs to be able to do two things:

  • Create directories
  • Do git clone and git pull on those directories over HTTP.

My problem is to do with permissions. When the new directories are created, they are owned by the www-data user. I've set up a global credential store to put the necessary git credentials to access the repos, but that's created under my ubuntu user.

I've tried fiddling with the visudo stuff so that the www-data user can execute the git commands as the ubuntu user, like the last answer here, but that still leaves me with a folder permissions problem.

I've read a bunch of similar questions on this, and they all seem to include a step where you manually change the folder permissions where you're storing the repository. However, in my case the folders get created on the fly.

Any help would be appreciated.

Mick Byrne
  • 14,394
  • 16
  • 76
  • 91
  • 1
    Why don't you just sudo to the www-data user and setup git credentials the normal way for that user? – Esben Skov Pedersen Jun 24 '17 at 11:35
  • Thanks for the comment - that is precisely what I tried to do at the beginning (that is my preferred scenario). However, for some reason the git commands to set the credential store and save those credentials won't work. I suspect it's because the home directory of the www-data user is `/var/www` for which the www-data users doesn't have write access. This is a weird tricky problem. – Mick Byrne Jun 25 '17 at 11:11

0 Answers0