GitPython无法找到负责人提交(GitPython Unable to Find Head C

2019-11-04 14:10发布

我想我的回购头部的commit对象。 当我尝试调用repo.head.commit不过,我得到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36-32\lib\site-packages\git\refs\symbolic.py", line 200, in _get_commit
    obj = self._get_object()
  File "C:\Python36-32\lib\site-packages\git\refs\symbolic.py", line 193, in _get_object
    return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "C:\Python36-32\lib\site-packages\git\objects\base.py", line 64, in new_from_sha
    oinfo = repo.odb.info(sha1)
  File "C:\Python36-32\lib\site-packages\git\db.py", line 37, in info
    hexsha, typename, size = self._git.get_object_header(bin_to_hex(sha))
  File "C:\Python36-32\lib\site-packages\git\cmd.py", line 1073, in get_object_header
    return self.__get_object_header(cmd, ref)
  File "C:\Python36-32\lib\site-packages\git\cmd.py", line 1062, in __get_object_header
    return self._parse_object_header(cmd.stdout.readline())
  File "C:\Python36-32\lib\site-packages\git\cmd.py", line 1024, in _parse_object_header
    raise ValueError("SHA could not be resolved, git returned: %r" % (header_line.strip()))
ValueError: SHA could not be resolved, git returned: b''

调用repo.head.commit第二次(事后每次),然后我得到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36-32\lib\site-packages\git\refs\symbolic.py", line 200, in _get_commit
    obj = self._get_object()
  File "C:\Python36-32\lib\site-packages\git\refs\symbolic.py", line 193, in _get_object
    return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "C:\Python36-32\lib\site-packages\git\objects\base.py", line 64, in new_from_sha
    oinfo = repo.odb.info(sha1)
  File "C:\Python36-32\lib\site-packages\git\db.py", line 37, in info
    hexsha, typename, size = self._git.get_object_header(bin_to_hex(sha))
  File "C:\Python36-32\lib\site-packages\git\cmd.py", line 1073, in get_object_header
    return self.__get_object_header(cmd, ref)
  File "C:\Python36-32\lib\site-packages\git\cmd.py", line 1061, in __get_object_header
    cmd.stdin.flush()

其它信息: repo.head - > <git.HEAD "HEAD">

我是在Windows 10环境。 这可能与我的另一个问题: - >桑巴的Windows共享目录的Git不与Ubuntu合作

Answer 1:

这个问题是从我的目录位于一个UNC路径上产生的,并通过更新我的Git版本固定。

Git的不与Ubuntu→桑巴的Windows共享目录工作



文章来源: GitPython Unable to Find Head Commit