git shell 中 python 脚本的路径问题
我正在尝试使用脚本 https://github.com/charleso/git-cc。你可以在那里看到麻烦的部分,它在 common.py 。
操作系统是windows 7。使用git shell,按照自述文件中的说明。 执行:
gitcc init /c/clearcase/myview/vob/
或
gitcc init c:/clearcase/myview/vob/
失败:
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, **args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 57, in popen
pipe = Popen(cmd, cwd=cwd, stdout=PIPE, stderr=PIPE, env=env)
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
如果我打开调试,它告诉我它正在尝试运行“git分支”。我已验证 os.environ 包含正确的路径,并且“git”位于该路径中。在“env”变量中使用 os.environ 仍然没有任何区别。 “git”和“gitbranch”可以从 shell 中正常执行。我做错了什么?
I'm trying to use script https://github.com/charleso/git-cc. You can see the troublesome part there, it's in common.py.
Operating system is windows 7. Using git shell, as instructed in the readme.
Executing:
gitcc init /c/clearcase/myview/vob/
or
gitcc init c:/clearcase/myview/vob/
fails with:
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, **args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 57, in popen
pipe = Popen(cmd, cwd=cwd, stdout=PIPE, stderr=PIPE, env=env)
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
If I turn on DEBUG, it tells me it is trying to run "git branch". I have verified os.environ contains correct path and "git" is in that path. Using os.environ in the "env" variable still made no difference. "git" and "git branch" work fine executing from the shell. What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,从 cygwin bash shell 运行它解决了问题并且运行良好。我应该猜到 git bash(mingw 系统)与 cygwin 的配合不太好。
Ok, running it from cygwin bash shell resolved the issue and it run out fine. I should've maybe guessed git bash (mingw system) doesn't play that well with cygwin.