Skip to content

Error using Chinese path or Chinese branch name #1362

Open
@xunmi-git

Description

@xunmi-git

Environmental Information

Windows10
Python3.8
GitPython 3.1.24

Error 1

Chinese path:

git.Repo.clone_from(url="git@gitee.com:xun-mi-git/test-x.git", to_path="C:\\Users\\asus\\3D Objects\\个人项目\\test")

Error message

Exception in thread Thread-6:
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1370, in _readerthread
    buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 41: illegal multibyte sequence

screenshot

寻觅_20210619020652

Error 2

Chinese branch:

    git.Repo.clone_from(url="git@gitee.com:xun-mi-git/test-x.git", to_path="C:\\test")
    a = Repo("C:\\test").remotes[0]
    for i in a.refs:
        print(i.name)
    a = a.pull()

Error message

origin/HEAD
origin/默认分支
Exception in thread Thread-7:
Traceback (most recent call last):
  File "C:\Users\asus\3D Objects\Python环境\常用通用库\lib\site-packages\git\cmd.py", line 109, in pump_stream
    for line in stream:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 58: illegal multibyte sequence

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\asus\3D Objects\Python环境\常用通用库\lib\site-packages\git\cmd.py", line 122, in pump_stream
    raise CommandError([f'<{name}-pump>'] + remove_password_if_present(cmdline), ex) from ex
git.exc.CommandError: Cmd('<stderr-pump>') failed due to: UnicodeDecodeError(''gbk' codec can't decode byte 0xae in position 58: illegal multibyte sequence')
  cmdline: <stderr-pump> git pull -v origin

screenshot

寻觅_20213119023148

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions