Revisions
-
mike-zhang revised this gist
Nov 29, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def githubReposBackup(hostName,userName,repoList): IdentityFile C:/Users/admin/.ssh/id_rsa_github_gist ''' #for gist def githubGistsBackup(host,gistList): for gist in gistList: print gist," : ", if os.path.exists(gist): @@ -80,4 +80,4 @@ def githubGistsBackup(host,userName,gistList): localGitBackup(host_local,dirList_local) githubReposBackup(host_github,userName_github,repoList_github) githubGistsBackup(host_gist,gistList_github) -
mike-zhang revised this gist
Nov 29, 2012 . 1 changed file with 0 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,14 +11,6 @@ /home/git/test1.git ''' def localGitBackup(hostName,dirList): for dirName in dirList: print dirName," : ", if os.path.exists(dirName): @@ -37,15 +29,6 @@ def localGitBackup(hostName,dirList): ''' #for github repos def githubReposBackup(hostName,userName,repoList): for repo in repoList: print repo," : ", if os.path.exists(repo): @@ -64,15 +47,6 @@ def githubReposBackup(hostName,userName,repoList): ''' #for gist def githubGistsBackup(host,userName,gistList): for gist in gistList: print gist," : ", if os.path.exists(gist): -
mike-zhang renamed this gist
Nov 29, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mike-zhang revised this gist
Nov 29, 2012 . 1 changed file with 42 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,14 +10,16 @@ repo example: /home/git/test1.git ''' def localGitBackup(hostName,dirList): ''' hostName = "host100" dirList = [ 'test1', 'test2' ] ''' for dirName in dirList: print dirName," : ", if os.path.exists(dirName): strCmd = "cd %s && git pull && cd .." % dirName @@ -34,15 +36,17 @@ def localGitBackup(): IdentityFile C:/Users/admin/.ssh/id_rsa_github ''' #for github repos def githubReposBackup(hostName,userName,repoList): ''' hostName = "github" userName = "mikezhang9986" repoList = [ 'cppCallLua', 'testCodes' ] ''' for repo in repoList: print repo," : ", if os.path.exists(repo): strCmd = "cd %s && git pull && cd .." % repo @@ -59,24 +63,47 @@ def githubReposBackup(): IdentityFile C:/Users/admin/.ssh/id_rsa_github_gist ''' #for gist def githubGistsBackup(host,userName,gistList): ''' host = "gist" userName = "mikezhang9986" gistList = [ '4166192', '4084385' ] ''' for gist in gistList: print gist," : ", if os.path.exists(gist): strCmd = "cd %s && git pull && cd .." % gist os.system(strCmd) else: strCmd = "git clone %s:%s.git " % (host,gist) os.system(strCmd) if __name__ == "__main__": host_local = "host100" host_github = "github" host_gist = "gist" userName_github = "mikezhang9986" dirList_local = [ 'test1', 'test2' ] repoList_github = [ 'cppCallLua', 'testCodes' ] gistList_github = [ '4166192', '4084385' ] localGitBackup(host_local,dirList_local) githubReposBackup(host_github,userName_github,repoList_github) githubGistsBackup(host_gist,userName_github,gistList_github) -
mike-zhang revised this gist
Nov 29, 2012 . 1 changed file with 55 additions and 56 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,74 +10,73 @@ repo example: /home/git/test1.git ''' def localGitBackup(): hostName = "host100" dirs = [ 'test1', 'test2' ] for dirName in dirs: print dirName," : ", if os.path.exists(dirName): strCmd = "cd %s && git pull && cd .." % dirName os.system(strCmd) else: strCmd = "git clone %s:%s.git " % (hostName,dirName) os.system(strCmd) ''' .ssh/config (windows,for github): Host github Hostname github.com User git IdentityFile C:/Users/admin/.ssh/id_rsa_github ''' #for github repos def githubReposBackup(): hostName = "github" userName = "mikezhang9986" repoNames = [ 'cppCallLua', 'testCodes' ] for repo in repoNames: print repo," : ", if os.path.exists(repo): strCmd = "cd %s && git pull && cd .." % repo os.system(strCmd) else: strCmd = "git clone %s:%s/%s.git " % (hostName,userName,repo) os.system(strCmd) ''' .ssh/config (windows,for github): Host gist Hostname gist.github.com User git IdentityFile C:/Users/admin/.ssh/id_rsa_github_gist ''' #for gist def githubGistsBackup(): hostName = "gist" userName = "mikezhang9986" repoNames = [ '4166192', '4084385' ] for gist in repoNames: print gist," : ", if os.path.exists(gist): strCmd = "cd %s && git pull && cd .." % gist os.system(strCmd) else: strCmd = "git clone %s:%s.git " % (hostName,gist) os.system(strCmd) if __name__ == "__main__": localGitBackup() githubReposBackup() githubGistsBackup() -
mike-zhang revised this gist
Nov 29, 2012 . 1 changed file with 59 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ import os ''' .ssh/config (windows,for local git server): Host host100 Hostname 192.168.1.100 User git IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100 repo example: /home/git/test1.git ''' hostName = "host100" dirs = [ @@ -19,14 +19,65 @@ for dirName in dirs: print dirName," : ", if os.path.exists(dirName): strCmd = "cd %s && git pull && cd .." % dirName os.system(strCmd) else: strCmd = "git clone %s:%s.git " % (hostName,dirName) os.system(strCmd) raw_input("Press Enter to continue") ''' .ssh/config (windows,for github): Host github Hostname github.com User git IdentityFile C:/Users/admin/.ssh/id_rsa_github Host gist Hostname gist.github.com User git IdentityFile C:/Users/admin/.ssh/id_rsa_github_gist Python code for github backup: #for github import os hostName = "github" userName = "mikezhang9986" repoNames = [ 'cppCallLua', 'testCodes' ] for repo in repoNames: print repo," : ", if os.path.exists(repo): strCmd = "cd %s && git pull && cd .." % repo os.system(strCmd) else: strCmd = "git clone %s:%s/%s.git " % (hostName,userName,repo) os.system(strCmd) Python code for gist backup: #for gist import os hostName = "gist" userName = "mikezhang9986" repoNames = [ '4166192', '4084385' ] for gist in repoNames: print gist," : ", if os.path.exists(gist): strCmd = "cd %s && git pull && cd .." % gist os.system(strCmd) else: strCmd = "git clone %s:%s.git " % (hostName,gist) os.system(strCmd) ''' -
MikeZhang revised this gist
Nov 29, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100 repo example: /home/git/test1.git ''' hostName = "host100" -
MikeZhang created this gist
Nov 29, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import os ''' .ssh/config (windows): Host host100 Hostname 192.168.1.100 User git IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100 repo example: /home/git/test1.git ''' hostName = "host100" dirs = [ 'test1', 'test2' ] for dirName in dirs: print dirName," : ", if os.path.exists(dirName): print "exists" strCmd = "cd %s && git pull && cd .." % dirName print strCmd os.system(strCmd) else: print "not exists" strCmd = "git clone %s:%s.git " % (hostName,dirName) os.system(strCmd) raw_input("Press Enter to continue")