Skip to content

Instantly share code, notes, and snippets.

@justbitguy
Last active August 29, 2015 14:23
Show Gist options
  • Save justbitguy/7415d1fd7983bc495b25 to your computer and use it in GitHub Desktop.
Save justbitguy/7415d1fd7983bc495b25 to your computer and use it in GitHub Desktop.
python code
# get exe dir: D:\Program Files (x86)\Git\bin
exe='git.exe'
cmd='where {0}'.format(exe)
exe_path =subprocess.check_output(cmd)
exe_dir =os.path.dirname(exe_path)
# add exe_dir into envionment PATH
path=os.environ['PATH']
os.environ['PATH'] += ";" + exe_dir
# git clone repos from sh.exe
git_clone_dir = os.path.join(os.getcwd(), 'a/b/c')
repo_host='git@a.b.c'
repo_name = 'tools'
if not os.path.exists(os.path.join(pi_bindings_dir, repo_name)):
cmd = "cd {0} && sh.exe --login -c \"git clone {1}:{2}\"".format(git_clone_dir, repo_host, repo_name)
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment