如何使用 PyGithub 在组织中创建新存储库 [英] How to create a new repository in an organization with PyGithub

查看:21
本文介绍了如何使用 PyGithub 在组织中创建新存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I create a new repository in an organization with PyGithub on Github? In particular I like to know how to use the create_repo method?

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

My question is identical to this question, but I would like the created repository to appear in an organization.

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

The solution to creating a repo without the organization level is:

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

推荐答案

这个链接给了我答案:link

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

I thought I would update my question to let others know what the solution was.

很简单:

from github import Github

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

repo = org.create_repo("test name")

这篇关于如何使用 PyGithub 在组织中创建新存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆