【发布时间】:2012-04-08 17:56:32
【问题描述】:
我正在尝试通过 root 用户从任何目录git pull 某个存储库。
例如,从/root/执行git pull:
#> 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
并从/ 执行git pull:
#> cd /
#> sudo -u dmalikov git --git-dir=/home/dmalikov/path/to/repo/.git pull
Already up-to-date.
为什么当前目录会影响git pulling 命令?
如何避免多余的cd?
【问题讨论】:
-
/root 是你仓库中的文件夹吗?如果是,您不应该有权限问题。如果 /root 在您的 git 结构之外,那么需要问的问题是它为什么首先访问该文件夹?
-
你为什么要以 root 身份工作?
-
我正在尝试使用 root,因为它是 eix-sync.conf 的内容。