我正在试着做一些简单的事情。至少我认为它应该很简单。
我们正在使用一个基于DevOps工具链的Azure python托管构建。源代码已经在这台构建机器上用git签出,并且运行良好。
在这个工具链中,我想从git中检索一些信息。我试着用
options = ['show', '-s', '--format=%ae', 'HEAD']
cmd = "git" + options
subprocess.check_output(cmd)(我希望我在这个例子中没有犯语法错误,我简化了一些部分)
我在构建服务器上得到的消息是:
ERROR git not found
Traceback (most recent call last):
...
in __git return subprocess.check_output(cmd) File d:\a\1\s\tools\python27\lib\subprocess.py", line 566,
...
WindowsError: [Error 2] The system cannot find the file specified 我还尝试对典型的windows路径使用绝对路径,但无法在托管构建计算机上找到git。我还查看了https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/git-commands?view=azure-devops&tabs=yaml
在我看来,使用git应该是可能的。嗯。有没有人对我有什么想法?
发布于 2019-11-25 21:46:18
检查您的代理是否启用了Git功能。
如果未添加,只需单击Add按钮并设置/usr/git功能
https://stackoverflow.com/questions/59032934
复制相似问题