简体   繁体   English

Gitlab:访问私有存储库的分支

[英]Gitlab: Accessing a fork of a private repository

We're attempting to use a private deployment of Gitlab for a university module.我们正在尝试将 Gitlab 的私有部署用于大学模块。 Here's what we are trying to do:这是我们正在尝试做的事情:

  • Each coursework exercise will be hosted on a private git repository (in a group)每个课程作业都将托管在私人 git 存储库上(在一个组中)
  • All students enrolled in the course will have access to that repository参加课程的所有学生都可以访问该存储库
  • The student will fork the private repository, clone it locally and start working学生将分叉私有存储库,将其克隆到本地并开始工作
  • The student will push his solution to his repository学生将他的解决方案推送到他的存储库
  • Staff members will pull the submissions of all students and grade them (hopefully with automated grading)工作人员将提取所有学生的提交并对其进行评分(希望能够自动评分)

All is well, except that we won't have access to the private repositories that the student forks .. We had a great idea to make each student add a public SSH key to their profile, but Alas!一切都很好,除了我们无法访问学生分叉的私有存储库..我们有一个好主意让每个学生在他们的个人资料中添加一个公共 SSH 密钥,但是唉! It is not possible since SSH keys have to be unique to each user .. are there any workarounds to this?这是不可能的,因为 SSH 密钥必须对每个用户都是唯一的……有什么解决方法吗?

Gitlab does have a feature called "Deploy Keys", which grant read-only access to a project, Students would need to manually add the public key to their project, but it would then provide you with access to their work. Gitlab 确实有一个名为“部署密钥”的功能,它授予对项目的只读访问权限,学生需要手动将公钥添加到他们的项目中,但它会为您提供对他们工作的访问权限。

I don't believe it would have the same restrictions as the standard user keys.我不相信它会有与标准用户密钥相同的限制。

To quote their documentation "Deploy keys allow read-only access to multiple projects with a single SSH key."引用他们的文档“部署密钥允许使用单个 SSH 密钥对多个项目进行只读访问。”

Further details ( https://docs.gitlab.com/ce/ssh/README.html#deploy-keys )更多细节( https://docs.gitlab.com/ce/ssh/README.html#deploy-keys

For those of you seeing this now, we managed to get this done using a mix of deploy keys and groups as suggested by @jdow .. However, this solution is a bit of a hack and has some disadvantages including:对于那些现在看到这一点的人,我们设法按照@jdow 的建议使用部署密钥和组的组合来完成此操作。但是,此解决方案有点麻烦,并且有一些缺点,包括:

  • Staff have no access to the repository员工无权访问存储库
  • Students have to manually enable the deploy keys for each forked repository学生必须为每个分叉存储库手动启用部署密钥

Therefore, I proposed a new feature called "gitlab classrooms" which I have detailed here因此,我提出了一个名为“gitlab 教室”的新功能,我在此处详细介绍了该功能

We're attempting to use a private deployment of Gitlab for a university module.我们正在尝试将Gitlab的私有部署用于大学模块。 Here's what we are trying to do:这是我们正在尝试做的事情:

  • Each coursework exercise will be hosted on a private git repository (in a group)每个课程作业都将托管在一个私人git存储库中(成组)
  • All students enrolled in the course will have access to that repository所有参加该课程的学生都可以访问该资料库
  • The student will fork the private repository, clone it locally and start working学生将派生私有存储库,在本地克隆它并开始工作
  • The student will push his solution to his repository学生将把自己的解决方案推送到自己的资料库
  • Staff members will pull the submissions of all students and grade them (hopefully with automated grading)员工将拉取所有学生的意见书并对其评分(希望能进行自动评分)

All is well, except that we won't have access to the private repositories that the student forks .. We had a great idea to make each student add a public SSH key to their profile, but Alas!一切都很好,除了我们无法访问该学生创建的私有存储库外。.我们有一个很好的主意,使每个学生都可以在其个人资料中添加一个公共SSH密钥,但是可惜! It is not possible since SSH keys have to be unique to each user .. are there any workarounds to this?由于SSH密钥对于每个用户而言都是唯一的,因此这是不可能的。对此是否有任何解决方法?

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

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