Last active
September 14, 2020 19:50
-
-
Save encima/6123067 to your computer and use it in GitHub Desktop.
Using the PyGithub library to create a new repo and initiate it in the current director.|-|{"files":{"github_makerepo.py":{"env":"plain"}},"tag":"Python"}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from github import Github | |
import sys, os | |
if len(sys.argv) == 4: | |
g = Github(sys.argv[1], sys.argv[2]) | |
g.get_user().create_repo(sys.argv[3]) | |
print '' + sys.argv[3] + ' created!' | |
print os.getcwd() | |
os.system('git init') | |
os.system('git remote add origin https://github.com/encima/%s.git' % sys.argv[3]) | |
else: | |
print 'Call this from the directory you want the git repo in!' | |
print 'Usage: python github_makerepo.py <username> <password> <repo_name>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment