I am trying to git pull
some repository via root user from any directory.
For example, executing git pull
from /root/
:
#> cd ~
#> sudo -u dmalikov git --git-dir=/home/dmalikov/path/to/repo/.git pull
/usr/libexec/git-core/git-sh-setup: line 142: cd: /root/.: Permission denied
Cannot chdir to /root/., the toplevel of the working tree
And executing git pull
from /
:
#> cd /
#> sudo -u dmalikov git --git-dir=/home/dmalikov/path/to/repo/.git pull
Already up-to-date.
Why did current directory affects git pull
ing command?
How can that redundant cd
be avoided?