File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change 22
33import argparse
44import os
5- import sys
6- from github_secrets import GITHUB_API_TOKEN , USERNAME
5+ from github_secrets import GITHUB_API_TOKEN
6+
77
88def parseArgs ():
99 parser = argparse .ArgumentParser (description = 'Push an existing local repository to a newly created remote repository of the same name' ) # noqa: E501
1010 parser .add_argument ('path' ,
11- metavar = 'PATH' ,
12- type = str ,
13- help = 'Enter the path for existing local repository' )
11+ metavar = 'PATH' ,
12+ type = str ,
13+ help = 'Enter the path for existing local repository' )
1414 parser .add_argument ('url' ,
15- metavar = 'URL' ,
16- type = str ,
17- help = 'Enter the newly created remote repository url (.git)' )
15+ metavar = 'URL' ,
16+ type = str ,
17+ help = 'Enter the newly created remote repository url (.git)' )
1818 parser .add_argument ('description' ,
19- metavar = 'DESCRIPTION' ,
20- type = str ,
21- help = 'Enter the description for remote repository' )
19+ metavar = 'DESCRIPTION' ,
20+ type = str ,
21+ help = 'Enter the description for remote repository' )
2222 args = parser .parse_args ()
23- return args
23+ return args
24+
2425
2526def pushRepo (remote_url ):
26- origin = remote_url [:8 ] + GITHUB_API_TOKEN + "@" + remote_url [8 :]
27+ origin = remote_url [:8 ] + GITHUB_API_TOKEN + "@" + remote_url [8 :]
2728 os .system (f'git push { origin } --mirror' )
28-
29+
30+
2931def main ():
3032 path = args .path
3133 remote_url = args .url
3234
3335 os .chdir (path )
34- if ( os .path .isdir ('./.git' ) == False ) :
36+ if os .path .isdir ('./.git' ) is False :
3537 print ("Not in a git directory" )
3638 exit ()
37-
39+
3840 pushRepo (remote_url )
3941
42+
4043if __name__ == "__main__" :
4144 args = parseArgs ()
42- main ()
45+ main ()
You can’t perform that action at this time.
0 commit comments