Search code examples
pythongithubautomationwebautomationpygithub

How to create private repository in Github using PyGithub


I figured out how to create repository on Github using PyGIthub by this method:

import sys
from github import Github

g = Github('AryanshMahato', 'GITHUB_PASSWORD')

user = g.get_user()
repo = user.create_repo(folderName)

But in this case PyGithub creates a public repository.

How can I create a private repository using PyGithub?


Solution

  • The official docs: Organization.create_repo

    You can set private parameter to True

    repo = user.create_repo(folderName, private=True)