git Github:只读访问私有仓库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2868432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github: readonly access to a private repo
提问by Jeroen
I am developing some private projects on Github, and I would like to add nightly cronjobs to my deployments servers to pull the latest version from github. I am currently doing this by generating keypairs on every deployment server and adding the public key to the github project as 'Deployment key'.
我正在 Github 上开发一些私人项目,我想将每晚的 cronjobs 添加到我的部署服务器以从 github 中提取最新版本。我目前通过在每个部署服务器上生成密钥对并将公钥添加到 github 项目作为“部署密钥”来做到这一点。
However, I recently found out that these deployment keys actually do have write access to the project. Hence, every of the server administrators could potentially start editing. Furthermore I can add every deployment key to only one repository, whereas I would like to be able to deploy multiple repositories on one and the same deployment server.
但是,我最近发现这些部署密钥实际上确实具有对项目的写访问权限。因此,每个服务器管理员都可能开始编辑。此外,我只能将每个部署密钥添加到一个存储库,而我希望能够在同一部署服务器上部署多个存储库。
Is there a way to provide read-only access for private repositories to selected users on Github?
有没有办法为 Github 上的选定用户提供私有存储库的只读访问权限?
采纳答案by pmdj
I have it on good authoritythat the (relatively new) "Organizations"feature allows you to add people with read-only access to a private repository.
回答by Adam Reis
For anyone else finding this question, know that nowadays you can in fact create read-only deploy keys:
对于发现此问题的其他任何人,请知道现在您实际上可以创建只读部署密钥:
https://github.com/blog/2024-read-only-deploy-keys
https://github.com/blog/2024-read-only-deploy-keys
You can still create deploy keys with write access, but have to explicitly grant that permission when adding the key.
您仍然可以创建具有写访问权限的部署密钥,但必须在添加密钥时明确授予该权限。
回答by chainwork
For Organizations: I suggest creating a new team specifically for the user. This team can then grant read-only access to the repositories you specify. I hope this helps!
对于组织:我建议专门为用户创建一个新团队。然后,该团队可以授予对您指定的存储库的只读访问权限。我希望这有帮助!