【问题标题】:git over ssh second user can't clonegit over ssh 第二个用户无法克隆
【发布时间】: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 连接第二个用户,所以这不是一个错误的密码。你知道我们为什么会遇到这个问题吗?

【问题讨论】:

    标签: linux git ssh


    【解决方案1】:

    您好像没有设置git deamon

    阅读整个页面(它很短)并按照步骤操作。 不要跳过您定义可以共享哪些项目的部分。

    【讨论】:

    • 我确实在那本书的 4.4 处停了下来(得到了纸质版)。我会阅读这篇文章并回来提供我的反馈。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-16
    • 2020-03-20
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多