Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e5ae98a

Browse files
Git_Repo_Creator added
1 parent 1305cd4 commit e5ae98a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎Git_Repo_Creator/Git_Repo_Creator.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import requests
2+
3+
def create_github_repo():
4+
user_name = input("Enter your GitHub user name: ")
5+
github_token = input("Enter your GitHub token: ")
6+
repo_name = input("Enter your repo Name: ")
7+
repo_description = input("Enter your repo description: ")
8+
9+
payload = {'name': repo_name, 'description': repo_description, 'auto_init': 'true'}
10+
repo_request = requests.post(f'https://api.github.com/user/repos', auth=(user_name, github_token), json=payload)
11+
12+
if repo_request.status_code == 422:
13+
print("GitHub repo already exists. Try with another name.")
14+
elif repo_request.status_code == 201:
15+
print("GitHub repo has been created successfully.")
16+
elif repo_request.status_code == 401:
17+
print("You are an unauthorized user for this action.")
18+
else:
19+
print(f"Error creating GitHub repo. Status code: {repo_request.status_code}")
20+
21+
if __name__ == "__main__":
22+
print("GitHub Repo Creator\n")
23+
create_github_repo()

‎Git_Repo_Creator/README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Git_Repo_Creator
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import requests
7+
8+
## Setup instructions
9+
10+
Just Need to Import requests then run the Git_Repo_Creator.py file and for running python3 is must be installed!
11+
12+
## Detailed explanation of script, if needed
13+
14+
This Script Is Only for Git_Repo_Creator use only!
15+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /