简体   繁体   English

在Ubuntu上有多个用户的Git存储库

[英]Git repository with multiple users on Ubuntu

I have an existing bare git repository located in /home/myaccount/git/project. 我在/ home / myaccount / git / project中有一个现有的裸git存储库。 I am currently using it over ssh from my local machine without any problems. 我目前正在使用ssh从我的本地机器上没有任何问题。 I want to add a second user on the server which only shall access to this git repository (maybe move the repo outside my account folder?). 我想在服务器上添加第二个用户,该用户只能访问这个git存储库(可能将repo移到我的帐户文件夹之外?)。 How? 怎么样? Using latest version of git and ubuntu on slicehost. 在slicehost上使用最新版本的git和ubuntu。

I have this setup: user: sleepyhead user: developer1 group: git. 我有这个设置:user:sleepyhead user:developer1 group:git。 both sleepyhead and developer1 are members of this group repository /home/sleepyhead/git/project1 sleepyhead和developer1都是这个组repository / home / sleepyhead / git / project1的成员

I want to: move repository to a proper place, either /home/git/project1 or /usr/local/git/project1. 我想:将存储库移动到适当的位置,/ home / git / project1或/ usr / local / git / project1。 What is recommended? 推荐什么? developer1 should permissions to read and write project1 with git. developer1应该有权使用git读写project1。 no other permissions should be given. 不应该给出其他权限。

I do not know how to properly set the permissions and to restrict developer1 to only have access using git to project1. 我不知道如何正确设置权限并限制developer1只能使用git访问project1。

Have him create a ssh keypair and send you the public key. 让他创建一个ssh密钥对并向您发送公钥。

Add the public key to your ~/.ssh/authorized_keys file, and add the command="..." option to limit it to the git-shell - see this link for an example. 将公钥添加到~/.ssh/authorized_keys文件中,并添加command="..."选项以将其限制为git-shell - 请参阅此链接以获取示例。

Orip's answer is probably all you need. 奥普里克的答案可能就是你所需要的。 If you want something a little more automated you might want to look at gitosis 如果你想要一些更自动化的东西,你可能想看看gitosis

您可能还希望将这两个用户放在同一个用户组中,并确保您对存储库具有组写权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM