简体   繁体   English

Gitlab中每个项目的SSH密钥

[英]SSH key per project in Gitlab

i have a problem that i don't know how to handle. 我有一个问题,我不知道如何处理。

I have 2 Repos in Gitlab , RepoA and RepoB. 我在Gitlab,RepoA和RepoB中有2个仓库。 In my gitlab user i have 3 ssh keys, one from my laptop and 2 from the 2 VM (VMA and VMB) that work with the 2 repos. 在我的gitlab用户中,我有3个ssh密钥,一个来自我的笔记本电脑,另外两个来自2个虚拟机(VMA和VMB),可以使用2个回购。 In this way i can pull and push easy from the VMs and from my laptop. 通过这种方式,我可以轻松地从虚拟机和笔记本电脑中进行推拉。

On RepoA i have a colaborator that also works. 在RepoA上我有一个也可以工作的合作者。 He has RepoA shared to his Gitlab account and he has access to VMA to push and pull code. 他将RepoA与他的Gitlab帐户共享,并且他可以访问VMA来推送和提取代码。 He sould never have access to RepoB, so from here comes my problem. 他永远都无法访问RepoB,所以我的问题来了。 If he can guess the RepoB url , he can pull and see it on the VMA where he has access already just becouse Gitlab does not have a granular way o adding ssh keys per project. 如果他可以猜到RepoB网址,他可以在他已经访问的VMA上拉取并看到它只是因为Gitlab没有一个细粒度的方法来为每个项目添加ssh密钥。 I probably am missing something very logical here but i just can't see what. 我可能在这里遗漏了一些非常合乎逻辑的东西,但我看不出是什么。

How can i give access to to my colaborator on VMA to only see RepoA. 如何才能在VMA上访问我的合作者才能看到RepoA。

A hack-ish way of doing this is to generate a 3rd user in gitlab that handles just VMA an the ssh key from VMA will be introduced in this user account on Gitlab. 这样做的一种黑客方法是在gitlab中生成第三个用户,只处理VMA,来自VMA的ssh密钥将在Gitlab上的这个用户帐户中引入。 But i bet there's got to be a better, cleaner way. 但我敢打赌,必须有一个更好,更清洁的方式。

GitLab has the feature of project-specific SSH keys: GitLab具有项目特定的SSH密钥的功能:

They are called Deployment keys . 它们被称为部署密钥 You can use them to provide read-only or read/write access for one or multiple repositories. 您可以使用它们为一个或多个存储库提供只读或读/写访问权限。

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

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