-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmygit.py
78 lines (62 loc) · 1.91 KB
/
mygit.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import pyautogui
import time
import os
from shutil import rmtree
re_commit_mess = str(input('enter your commit message[+]'))
repo_url = str(input('enter your repo.Url[+]'))
commit_mess = f"\"{re_commit_mess}\""
# repo_url = "https://github.com/nerov103/example.git"
step_0 = "git init"
step_1 = "git add ."
step_2 = f"git commit -m {commit_mess}" #enter your commit meassge
step_3 = "git branch -M main"
step_4 = f"git remote add origin {repo_url}" #enter your reponame
step_5 = "git push -u -f origin main"
clik = pyautogui.moveTo(800, 1000)
pyautogui.click(clik)
#stetment for git init command
time.sleep(2)
if os.access(".git", os.F_OK):
print("exists .git")
else:
pyautogui.write(step_0)
pyautogui.press('enter')
time.sleep(0.5)
#None error in git add . command
pyautogui.write(step_1)
pyautogui.press('enter')
time.sleep(0.5)
#stetment for git commit meassge
pyautogui.write(step_2)
pyautogui.press('enter')
time.sleep(0.5)
# print(" plaess double quotation marks "" in the commit meassge")
#eror handler in exists repo
# root_path = "/home/backbox/For BackBox/Pyautogui/.git/config"
# with open(os.path.join(root_path), 'r') as f:
# config_file_text_len = len(f.read())
# if int(config_file_text_len) <=92:
# print('repo. exists')
# if config_file_text_len >=92:
# pyautogui.write(step_3)
# pyautogui.press('enter')
# time.sleep(0.5)
pyautogui.write(step_3)
pyautogui.press('enter')
time.sleep(0.5)
pyautogui.write(step_4)
pyautogui.press('enter')
time.sleep(0.5)
pyautogui.write(step_5)
pyautogui.press('enter')
time.sleep(0.5)
print("=================================")
# mess = "Code Run in Successly"
# for i in mess:
# print(i, end="", flush=True)
# time.sleep(0.2)
# print("Success!")
# print(commit_mess)
# getdir = os.getcwd()
# ro_path = os.path.join(getdir, ".git")
# rmtree(ro_path)