Git pull wih www-data permissions -


i have git repository has dev, test , staging branches pulled vhost on server. need able git pull on server using user account files pulled owned www-data user (and group). when used svn sudo www-data , svn update --username --password options authenticate against svn user maintain correct file ownership. there way git (i use ssh keys rather password authentication).

you want set option on repository you're pulling (extract git config):

  core.sharedrepository        when group (or true), repository made shareable between several        users in group (making sure files , objects        group-writable). when (or world or everybody), repository        readable users, additionally being group-shareable. when        umask (or false), git use permissions reported umask(2). when        0xxx, 0xxx octal number, files in repository have        mode value.  0xxx override user’s umask value (whereas        other options override requested parts of user’s umask        value). examples: 0660 make repo read/write-able        owner , group, inaccessible others (equivalent group        unless umask e.g.  0022).  0640 repository        group-readable not group-writable. see git-init(1). false        default. 

to set option, cd working tree or repository needs have right group/mode (not origin repository want pull from), , run git config core.sharedrepository group. doesn't set mode files in repository, makes sure owned group owns root of repository. option takes effect whether you're working locally in repository or pushing repository (e.g. via git:// protocol).

if you've created files in repository wrong owner and/or mode not having option set, you'll first need cd repository , runchmod -r g+rw . , chgrp -r www-data . consistent state.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -