为什么root可以看到dir而不是用户?

我通过root在我的vps上创build了一个git repo,并且让它共享,这样一组人就可以访问它:

# mkdir example.git # cd example.git # git init --bare --shared=group Initialized empty shared Git repository in /root/example.git/ # ls branches config description HEAD hooks info objects refs # chgrp -R devs . 

然后作为我的本地PC上的用户,我创build了一个目录,并添加example.git作为此git仓库的新来源。 最后,我试图推动起源:

 mkdir bubbles && cd bubbles bubbles ranuka$ git init Initialized empty Git repository in /Users/ranuka/Desktop/bubbles/.git/ bubbles ranuka$ ls bubbles ranuka$ git remote add origin [email protected]:example.git bubbles ranuka$ echo "Hello" > readme.txt bubbles ranuka$ git add readme.txt bubbles ranuka$ git commit -m "Adding a readme file" [master (root-commit) 2c89e43] Adding a readme file 1 file changed, 1 insertion(+) create mode 100644 readme.txt bubbles ranuka$ git push origin master [email protected]'s password: fatal: 'example.git' does not appear to be a git repository 

由于我知道example.git显然是我的vps上的回购,所以被这个错误所迷惑。 我login在我的VPS为“ranuka”,并试图cd到example.git但不能,但由于某种原因,我可以作为根..什么给?

我的目标是在我的vps上创build一个git repo,一群用户可以访问并进行推送。

编辑:在[email protected]运行ls -a和[email protected]运行结果如下:

 . example.git .. gitosis ajenti-repo-1.0-1.noarch.rpm install.log anaconda-ks.cfg install.log.syslog .bash_history pgdg-centos93-9.3-1.noarch.rpm .bash_logout .pki .bash_profile repo.git .bashrc .rnd .cshrc .ssh epel-release-6-8.noarch.rpm .tcshrc 

 . .. .bash_logout .bash_profile .bashrc 

所以看起来好像root和ranuka位于不同的目录,没有任何关系。

不同的用户有不同的主文件夹。
如果您以root身份login,则主/root/root
没有其他用户将能够访问。

如果您以ranuka身份login,那么家是(可能) /home/ranuka
因为它在/root ,所以当然不包含这个文件夹。