Git 共享存储库:没有额外用户的正确访问权限



我在 Linux CentOS 服务器上创建了一个 git 裸存储库:

/home/git

/niels.git.

用户 git 和 niels 在组中 git。

我改变了/etc/passwd,所以尼尔斯的家庭目录是 git。

ssh 作为 git to niels.git:推拉精细。

SSH 作为 niels 以同样的方式给出:

fatal: '~/niels.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

显然,存储库存在,因为我可以作为 git 访问它。这里有一些权利和组信息:

# ls -al /home/git
total 32
drwxrwx--- 4 git  git   4096 Sep 20 22:11 .
drwxr-xr-x 5 root root  4096 Sep 17 14:39 ..
-rwxr----- 1 git  10009  953 Sep 17 14:19 .bash_history
-rwxr----- 1 git  10009   33 Sep 12 22:46 .bash_logout
-rwxr----- 1 git  10009  176 Sep 12 22:46 .bash_profile
-rwxr----- 1 git  git    124 Sep 12 22:46 .bashrc
drwxrw---- 7 git  git   4096 Sep 17 17:19 niels.git
drwxr----- 2 root 10009 4096 Sep 15 22:40 .ssh
# groups niels
niels : niels git 

我做错了什么?

哦,顺便说一句,我尝试了各种许可,例如

chmod -R 740 /home/git

和 766 666但只有 777 我才能获得解放:

Already up-to-date.

但这不可能是这样...

但这不可能是这样...

然而,这是方式:您不应该像"git"以外的任何其他用户一样在/home/git/下访问存储库。

SSH 在

远程服务器(包含上游存储库的服务器)上打开一个安全 shell,该 shell 与您在 SSH URL 中提到的用户一起使用:git 。这适用于访问/home/git

更改/etc/password不足以更改该主目录的所有权

您可以尝试:

sudo chmod 744 -R egit /home/git

(但随后帐户git将在访问这些相同的存储库时遇到问题)

最新更新