编程语言
首页 > 编程语言> > python-如何使用PyGithub在组织中创建新的存储库

python-如何使用PyGithub在组织中创建新的存储库

作者:互联网

如何在Github上使用PyGithub在组织中创建新的存储库?我特别想知道如何使用create_repo方法?

我的问题与this question相同,但是我希望创建的存储库出现在组织中.

在没有组织级别的情况下创建存储库的解决方案是:

g = Github("username", "password")
user = g.get_user()
repo = user.create_repo(full_name)

解决方法:

该链接给了我答案:link

我以为我会更新我的问题,让其他人知道解决方案是什么.

很简单:

from github import Github

# using username and password
g = Github("Username", "Password")
org = g.get_organization('orgName')

repo = org.create_repo("test name")

标签:python,github,api,github-api,pygithub
来源: https://codeday.me/bug/20191010/1885157.html