本质上,我试图使用子进程调用来签出特定 sha 哈希处的 git 提交。
但是,我不断收到错误subprocess.CalledProcessError: Command '['git', 'checkout', '62bbce43e']' returned non-zero exit status 128.
这是我的代码如下:
with open(filename) as inputfile:
reader = csv.reader(inputfile, delimiter=",")
linecount = 0
for row in reader:
if linecount == 0:
linecount += 1
else:
repo = str(row[0])
sha = str(row[2])
specificfile = str(row[3])
linenum = int(row[4])
cl("cd", repo)
subprocess.check_output(['git', 'checkout', sha])
print("checkout done")
git("checkout", "-")
Run Code Online (Sandbox Code Playgroud)