命令 '['git' 'clone', '--recurse-submodules', '--', 'ssh://git@git/b2b/py_client.git'] 返回非零退出状态 128

Posted

技术标签:

【中文标题】命令 \'[\'git\' \'clone\', \'--recurse-submodules\', \'--\', \'ssh://git@git/b2b/py_client.git\'] 返回非零退出状态 128【英文标题】:Command '['git' 'clone', '--recurse-submodules', '--', 'ssh://git@git/b2b/py_client.git'] returned non-zero exit status 128命令 '['git' 'clone', '--recurse-submodules', '--', 'ssh://git@git/b2b/py_client.git'] 返回非零退出状态 128 【发布时间】:2021-12-29 16:49:29 【问题描述】:

我正在尝试使用 make setup 和 Git Bash 中的诗歌创建 virtualenv:

$ make setup
poetry install --no-root
Creating virtualenv ad-ml in C:\Users\user1\Documents\ad_ml\.venv
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

  CalledProcessError

  Command '['C:\\Users\\user1\\AppData\\Local\\Programs\\Git\\mingw64\\bin\\git.exe'
, 'clone', '--recurse-submodules', '--', 'ssh://git@git.bcb.local:7999/b2b/py_client.git', 
'C:\\Users\\EMANZH~1\\AppData\\Local\\Temp\\pypoetry-git-py_clien9fdvh9lr']'
 returned non-zero exit status 128.

  at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\_compat.py:217 in run

并获得退出状态为 128 的 CalledProcessError 和另一个异常:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user1\Anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user1\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\user1\AppData\Roaming\Python\Scripts\poetry.exe\__main__.py", line 7, in <module>
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\__init__.py", line 5, in main
    return Application().run()
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\console_application.py", line 142, in run
    trace.render(io, simple=isinstance(e, CliKitException))
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\ui\components\exception_trace.py", line 232, in render
    return self._render_exception(io, self._exception)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\ui\components\exception_trace.py", line 269, in _render_exception
    self._render_snippet(io, current_frame)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\ui\components\exception_trace.py", line 289, in _render_snippet
    self._render_line(io, code_line)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\ui\components\exception_trace.py", line 402, in _render_line
    io.write_line("".format(indent * " ", line))
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\io\io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\api\io\io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\api\io\output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\api\io\output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "C:\Users\user1\AppData\Roaming\pypoetry\venv\lib\site-packages\clikit\io\output_stream\stream_output_stream.py", line 24, in write
    self._stream.write(string)
  File "C:\Users\user1\Anaconda3\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2502' in position 27: character maps to <undefined>

有什么办法可以解决这个错误吗,不胜感激。

pc windows 10,git bash 2.34.0,使用来自 bitbucket 的 sourcetree 克隆的 repo,python 3.8.8

【问题讨论】:

【参考方案1】:

首先检查这是否类似于python-poetry/poetry issue 3297,它指的是pypa/virtualenv issue 1986

第一个链接包括(Daniel Taylor):

我们在我们的circle CI windows executors中将conda环境中的virtualenv降级,不确定是否使用pip

因此,将这样的步骤添加到您的 yml 配置应该可以解决问题(或者只是将 virtualenv=20.0.33 添加到安装 conda 依赖项的步骤中):

- run: conda install virtualenv=20.0.33

OP Taky提议in the comments:

我将pyproject.toml 中的dependency 链接从“ssh”更改为“https”,这对我有用。

【讨论】:

感谢您的回答!我将 pyproject.toml 中 py_client.git 的依赖链接从“ssh”更改为“https”,这对我有用。 @Taky 干得好。我已将您的评论包含在答案中以提高知名度。

以上是关于命令 '['git' 'clone', '--recurse-submodules', '--', 'ssh://git@git/b2b/py_client.git'] 返回非零退出状态 128的主要内容,如果未能解决你的问题,请参考以下文章

git命令之git clone用法

Git Clone 命令指定用户名密码

linux git clone命令啥意思

【Git】git clone命令报错:host key verification failed

git clone -b 相关

git clone