Skip to content

Error using Chinese path or Chinese branch name #1362

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

ExceptioninthreadThread-6:
Traceback (mostrecentcalllast):
File"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line932, in_bootstrap_innerself.run()
File"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line870, inrunself._target(*self._args, **self._kwargs)
File"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line1370, in_readerthreadbuffer.append(fh.read())
UnicodeDecodeError: 'gbk'codeccan'tdecodebyte0xaainposition41: illegalmultibytesequence

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]
foriina.refs:
print(i.name)
a=a.pull()

Error message

origin/HEADorigin/默认分支ExceptioninthreadThread-7:
Traceback (mostrecentcalllast):
File"C:\Users\asus\3D Objects\Python环境\常用通用库\lib\site-packages\git\cmd.py", line109, inpump_streamforlineinstream:
UnicodeDecodeError: 'gbk'codeccan'tdecodebyte0xaeinposition58: illegalmultibytesequenceTheaboveexceptionwasthedirectcauseofthefollowingexception:
Traceback (mostrecentcalllast):
File"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line932, in_bootstrap_innerself.run()
File"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line870, inrunself._target(*self._args, **self._kwargs)
File"C:\Users\asus\3D Objects\Python环境\常用通用库\lib\site-packages\git\cmd.py", line122, inpump_streamraiseCommandError([f'<{name}-pump>'] +remove_password_if_present(cmdline), ex) fromexgit.exc.CommandError: Cmd('<stderr-pump>') faileddueto: UnicodeDecodeError(''gbk' codec can'tdecodebyte0xaeinposition58: illegalmultibytesequence')
cmdline: <stderr-pump>gitpull-vorigin

screenshot

寻觅_20213119023148

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions