我想我的回购头部的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合作