-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitcreate.py
More file actions
33 lines (24 loc) · 903 Bytes
/
gitcreate.py
File metadata and controls
33 lines (24 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import sys
from github import Github
def create():
folderName = str(sys.argv[1])
path = 'E:/test/' # add projects dirctory to the env vars
token = 'bfa0b236b3b1ed923a8865e0be15659f14235dba' # add github token to the env vars
g = Github(token)
user = g.get_user()
login = user.login
repo = user.create_repo(folderName)
# print(folderName)
os.mkdir(path + str(folderName))
os.chdir(path + str(folderName))
os.system(f'echo "# {folderName}" >> README.md')
os.system('git init')
os.system(f'git remote add origin https://github.com/Wiener234/{folderName}.git')
os.system('git add .')
os.system('git commit -m "Initial commit"')
os.system('git push -u origin master')
os.system('code .')
print("Succesfully created repository {}" .format(folderName) + "and started vs code")
if __name__ == "__main__":
create()