python中执行git clone 命令,怎样在工程clone完成后执行另一个方法_百...
发布网友
发布时间:2022-05-05 17:55
我来回答
共1个回答
热心网友
时间:2022-05-10 11:21
直接执行
下面是一种解决方案
1 把gitbash 的路径放到系统的Path环境变量里 我的是 C:\Program Files (x86)\Git\bin
2 这时候 你在系统命令行里就可以用git了
3 在python里倒入 os 模块 然后执行
os.system('git') 就可以了
C:\Users\Administrator>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win3
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system('git')
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the wo