I was testing gitPython's clone from function like this,
git.Repo.clone_from("https://github.com/nicothin/web-design.git","/home/tom/src",branch='master',recursive=True)
but it always gives error like,
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/git/repo/base.py", line 885, in clone_from
return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/git/repo/base.py", line 831, in _clone
finalize_process(proc)
File "/usr/local/lib/python2.7/dist-packages/git/util.py", line 155, in finalize_process
proc.wait()
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 319, in wait
raise GitCommandError(self.args, status, self.proc.stderr.read())
ValueError: I/O operation on closed file
Could some one plz tell me how to fix this? I tried to fix the GIT_PYTHON_GIT_EXECUTEABLE and GIT_PYTHON_TRACE , they both are not working.
OK, I fixed this by myself. It's a bug according to GitHub issue record like this. I was running Ubuntu 15.10, default GitPython version is 1.0.2, so I couldn't debug this since I won't know the git command returns.
After I get the source code from GitPython github repo and installed, I was able to see what's going on in the exception. It end's up the clone_from() command's target path must be a new path, if it's already there, there will be a git command error raised, so I just changed it to
git.Repo.clone_from("https://github.com/nicothin/web-design.git","/home/tom/src/mustBeNewPath",branch='master',recursive=True)
the issue solved.