Allow User ‘git’ to run ‘git pull’ as ‘www-data’ via sudo

gitsudowww-data

I would like to allow git to run 'git pull' as user 'www-data'. As far as i understand

    git ALL=(www-data) git pull

in /etc/sudoers should make it.

Sadly i get an Syntax error for this line and visudo Syntax highlight breaks right after the "-" in 'www-data'

Can't find information regarding forbidden '-' in /etc/sudoers usernames. Any tips?

Best Answer

You need to use full path name for 'git' command, following lines doesn't produce syntax error in visudo and works fine.

git ALL = (www-data) /usr/bin/git pull