如何使用 PyGithub 将外部协作者添加到单个组织存储库?

How to add an outside collaborator to an individual organization repository using PyGithub?

我正在编写一个 python 应用程序,它使用 GitHub 使用 PyGitHub 库。我有一个包含多个私人回购的组织。我想邀请两个不同的用户并授予他们对两个不同存储库的只读访问权限。

我一直在查看 PyGitHub 文档,但似乎没有办法将单个协作者添加到存储库而不让他成为团队的一员并允许他访问所有存储库在组织中。

https://pygithub.readthedocs.io/en/latest/github_objects/Organization.html

有人知道怎么做吗?

它与任何其他存储库没有什么不同,对组织来说也不是特别的。通过 get_repo() and then use add_to_collaborators().

获取您感兴趣的 Repository