【发布时间】:2023-04-10 08:36:01
【问题描述】:
我们是一个项目的两个开发人员,我在服务器 (ArchLinux) 上设置了一个 git 存储库,我们都可以通过 ssh 访问。 git 存储库是通过以下方式创建的:
mkdir project
touch project/readme.txt
git init project
cd projet
git add .
git commit -m 'initial commit'
git push origin master
cd ..
git clone --bare project.git
cd project.git
git config core.sharedRepository true
cd ..
setfacl -R -m g:<group name>:rwX project.git
find gitrepo -type d | xargs setfacl -R -m d:g:<group name>:rwX
我们的组名是 dev 并且两个用户都在组中(在 /etc/groups 中签入)
在第二台机器(可以是我的或第二个开发者的)上,我们以这种方式克隆存储库。
git clone user1@ip:/path/project.git (over ssh)
password: <enter user1 password>
所有内容都放在文件夹项目中。该用户现在可以进行添加、推送、拉取等操作。
然后我们尝试第二个用户
git clone user2@ip:/path/project.git (over ssh)
password: <enter user2 password>
我们得到了这个
fatal: '/path/project.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.
我们可以毫无问题地使用 SSH 连接第二个用户,所以这不是一个错误的密码。你知道我们为什么会遇到这个问题吗?
【问题讨论】: