简体   繁体   English

限制 Github 访问 ssh 和 https URL 中的单个存储库

[英]Restrict Github access to a single repository in ssh and https URL

I want to deploy software on a machine for a customer but have multiple private repositories and also belong to multiple organizations.我想在一台机器上为客户部署软件,但有多个私有存储库,也属于多个组织。

I do not want to give the customer access to all the organizations of which I am a member.我不想让客户访问我所属的所有组织。 All I want to do is to deploy the code and allow the customer to update it periodically.我想要做的就是部署代码并允许客户定期更新它。

There is a similar question here: Restrict Github API access to only one repository of a user这里有一个类似的问题:Restrict Github API access to only one repository of a user

However, I cannot see a way of restricting the SSH access to a single repository in Github.但是,我看不到限制对 Github 中单个存储库的 SSH 访问的方法。

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/ https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

Does anyone know how I can allow access to a single private repository only on a remote PC?有谁知道我如何只允许在远程 PC 上访问单个私有存储库?

Are you giving the customer access to your account?您是否允许客户访问您的帐户? That seems to be how someone can access your private repositories.这似乎是某人可以访问您的私人存储库的方式。

You can have the customer create a git account, add them as a collaborator to your private repository and add the ssh key of the machine to their account.您可以让客户创建一个 git 帐户,将他们作为协作者添加到您的私有存储库中,并将机器的 ssh 密钥添加到他们的帐户中。 The customer then can use their account to access your repository.然后客户可以使用他们的帐户访问您的存储库。 I believe that way they will have access to their repository, but not your other repositories.我相信这样他们将可以访问他们的存储库,但不能访问您的其他存储库。

If you want to restrict Git access to a single repository, then you can use an SSH deploy key , which may be either read only or read-write.如果您想限制 Git 对单个存储库的访问,那么您可以使用SSH 部署密钥,该密钥可以是只读的,也可以是读写的。 They're designed for exactly this case.它们正是为这种情况而设计的。 GitHub doesn't currently provide a way to limit access to a single repository based on HTTP credentials. GitHub 目前不提供基于 HTTP 凭据限制对单个存储库的访问的方法。

Note that deploy keys must be unique;请注意,部署密钥必须是唯一的; that is, a single deploy key must be a different key than is used for any user or for any other repository.也就是说,单个部署密钥必须与用于任何用户或任何其他存储库的密钥不同。

You could also add the customer as a collaborator on that single repo, in which case they'd be able to access that repo, but not anything else.您还可以将客户添加为该单个存储库的合作者,在这种情况下,他们将能够访问该存储库,但不能访问其他任何内容。

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

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