i would like to run a git pull and specify the directory. some say using –git-dir and –work-tree should work but such as
git --git-dir=/var/www/.git --work-tree=/var/www pull
put this returns a “cannot be used without a working tree”. The only time i can get this to work is if i use “.”, “..” or any directory above the current directory
this post suggests maybe a bug?
git pull while not in a git directory
in the end i need to run a sudo git pull in a single line. i welcome any work arounds. thanks
Use sudo and give the command as an argument to sh?
Something like: