简体   繁体   English

Python 安装私有 github 回购给出“退出状态 128”错误?

[英]Python installing private github repo giving "exit status 128" error?

I am on Windows 10 running Python 3.7.我在 Windows 10 运行 Python 3.7。

I am trying to install a Python package on one of my private GitHub repositories.我正在尝试在我的私人 GitHub 存储库之一上安装 Python package。 I want to use the GitHub deploy key to give only read access to the single repository.我想使用 GitHub deploy key只授予对单个存储库的读取访问权限。

So I generated the deploy key using所以我使用生成了部署密钥

ssh-keygen -t rsa -b 4096 -C "email@domain.com"

This added the private and public key to the .ssh folder on my user machine.这将私钥和公钥添加到我的用户计算机上的.ssh文件夹中。 I then copied the public key to the deploy keys for my private GitHub python package repository.然后我将公钥复制到我的私有 GitHub python package 存储库的部署密钥。

Then I generated a virtualenv and tried to run the command然后我生成了一个virtualenv并尝试运行命令

pip install git+ssh://git@github.com/<github_username>/<repo_name>.git

but I keep getting an error saying但我一直收到错误提示

ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@github.com/<github_username>/<repo_name>.git' 'C:\Users\Alex\AppData\Local\Temp\pip-req-build-doj1og3o' Check the logs for full command output.

I've looked at other posts with the similar issue and as far as I can tell my syntax for the installation command is correct.我看过其他有类似问题的帖子,据我所知,我的安装命令语法是正确的。

Here is my error log output:这是我的错误日志 output:

2020-10-13T09:36:22,708 Using pip 20.2.3 from c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip (python 3.7)
2020-10-13T09:36:22,710 Non-user install because user site-packages disabled
2020-10-13T09:36:22,718 Created temporary directory: C:\Users\Alex\AppData\Local\Temp\pip-ephem-wheel-cache-35_xjrvi
2020-10-13T09:36:22,719 Created temporary directory: C:\Users\Alex\AppData\Local\Temp\pip-req-tracker-6m9f9yue
2020-10-13T09:36:22,719 Initialized build tracking at C:\Users\Alex\AppData\Local\Temp\pip-req-tracker-6m9f9yue
2020-10-13T09:36:22,719 Created build tracker: C:\Users\Alex\AppData\Local\Temp\pip-req-tracker-6m9f9yue
2020-10-13T09:36:22,721 Entered build tracker: C:\Users\Alex\AppData\Local\Temp\pip-req-tracker-6m9f9yue
2020-10-13T09:36:22,722 Created temporary directory: C:\Users\Alex\AppData\Local\Temp\pip-install-wco_t2va
2020-10-13T09:36:22,730 Collecting git+ssh://****@github.com/<github_username>/<repo_name>.git
2020-10-13T09:36:22,731   Created temporary directory: C:\Users\Alex\AppData\Local\Temp\pip-req-build-21n7avhs
2020-10-13T09:36:22,732   Cloning ssh://****@github.com/<github_username>/<repo_name>.git to c:\users\alex\appdata\local\temp\pip-req-build-21n7avhs
2020-10-13T09:36:23,013 ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@github.com/<github_username>/<repo_name>.git' 'C:\Users\Alex\AppData\Local\Temp\pip-req-build-21n7avhs' Check the logs for full command output.
2020-10-13T09:36:23,016 Exception information:
2020-10-13T09:36:23,016 Traceback (most recent call last):
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\cli\base_command.py", line 228, in _main
2020-10-13T09:36:23,016     status = self.run(options, args)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
2020-10-13T09:36:23,016     return func(self, options, args)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\commands\install.py", line 324, in run
2020-10-13T09:36:23,016     reqs, check_supported_wheels=not options.target_dir
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 183, in resolve
2020-10-13T09:36:23,016     discovered_reqs.extend(self._resolve_one(requirement_set, req))
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 388, in _resolve_one
2020-10-13T09:36:23,016     abstract_dist = self._get_abstract_dist_for(req_to_install)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 340, in _get_abstract_dist_for
2020-10-13T09:36:23,016     abstract_dist = self.preparer.prepare_linked_requirement(req)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\operations\prepare.py", line 469, in prepare_linked_requirement
2020-10-13T09:36:23,016     hashes=self._get_linked_req_hashes(req)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\operations\prepare.py", line 239, in unpack_url
2020-10-13T09:36:23,016     unpack_vcs_link(link, location)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\operations\prepare.py", line 99, in unpack_vcs_link
2020-10-13T09:36:23,016     vcs_backend.unpack(location, url=hide_url(link.url))
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\vcs\versioncontrol.py", line 733, in unpack
2020-10-13T09:36:23,016     self.obtain(location, url=url)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\vcs\versioncontrol.py", line 641, in obtain
2020-10-13T09:36:23,016     self.fetch_new(dest, url, rev_options)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\vcs\git.py", line 230, in fetch_new
2020-10-13T09:36:23,016     self.run_command(make_command('clone', '-q', url, dest))
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\vcs\versioncontrol.py", line 774, in run_command
2020-10-13T09:36:23,016     log_failed_cmd=log_failed_cmd)
2020-10-13T09:36:23,016   File "c:\users\alex\downloads\github_deploy_keys\env\lib\site-packages\pip\_internal\vcs\versioncontrol.py", line 166, in call_subprocess
2020-10-13T09:36:23,016     raise SubProcessError(exc_msg)
2020-10-13T09:36:23,016 pip._internal.exceptions.SubProcessError: Command errored out with exit status 128: git clone -q 'ssh://****@github.com/<github_username>/<repo_name>.git' 'C:\Users\Alex\AppData\Local\Temp\pip-req-build-21n7avhs' Check the logs for full command output.
2020-10-13T09:36:23,032 Removed build tracker: 'C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-req-tracker-6m9f9yue'

Hello I had this same exact problem!您好,我遇到了同样的问题!

I found the answer on:我找到了答案:

https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey

It turns out that I needed to ensure that my ssh key was being used .事实证明,我需要确保我的 ssh 密钥正在被使用 I did so by following the directions on the github site which suggested that I run this command :我按照 github 网站上的指示执行此操作,该网站建议我运行此命令

ssh -vT git@github.com

I ran this command prompt and It worked.我运行了这个命令提示符并且它起作用了。 I don't know how or why but it seems to have reset some sort of configuration to where my ssh shell now works.我不知道如何或为什么,但它似乎已将某种配置重置为我的 ssh shell 现在工作的位置。 I'd tried all sorts of different solutions and was getting very discouraged about it because my linux setup worked fine!我尝试了各种不同的解决方案,但对此感到非常沮丧,因为我的 linux 设置工作正常! It was windows 10 that seemed to be giving me trouble.似乎给我带来麻烦的是 windows 10。

After that I was able to pip install from github using the powershell inside of vscode (with a venv enabled).之后,我能够使用 vscode 内部的 powershell(启用了 venv)从 github 安装 pip。

I originally thought that the issue was my sshkey (that I'd pasted it wrong) but that wasn't the case.我最初认为问题出在我的 sshkey(我粘贴错了),但事实并非如此。 I also thought it might have been something with visual studio code but that wasn't the case either.我还认为它可能与 visual studio 代码有关,但事实也并非如此。 Then I thought it might have been something with my security protocols.然后我认为这可能与我的安全协议有关。 SO I tried enabling and disabling different ports through my firewall that were suggested in other forums and that didn't work either.所以我尝试通过我的防火墙启用和禁用不同的端口,这些端口在其他论坛中被建议并且也没有用。

I knew something was up because whenever I created a key on my Desktop it would never show any activity of use when I viewed my keys on Github. But as soon as I ran the command a green light appeared and showed that it was recently activated.我知道出了问题,因为每当我在桌面上创建一个密钥时,当我在 Github 上查看我的密钥时,它永远不会显示任何使用活动。但是一旦我运行命令,就会出现绿灯并显示它最近被激活。 I have 2 ssh keys enabled (laptop and desktop) for my private repo and use it to pip install packages from there.我为我的私人存储库启用了 2 个 ssh 密钥(笔记本电脑和台式机),并使用它从那里安装软件包 pip。

I hope this helps somebody out there.我希望这可以帮助那里的人。 Sorry if I spoke too much.对不起,如果我说得太多了。 This is my first post.这是我的第一篇文章。 I just found this solution and had to share it because I was so excited!我刚找到这个解决方案,不得不分享它,因为我太兴奋了!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pip 通过 requirements.txt 安装指定直接 GitHub 私人仓库 + 分支名称错误,退出状态为 128 - pip install via requirements.txt specify a direct GitHub private repo + branch name erroring with exit status 128 使用Python的子进程将git repo推送到GitHub返回退出代码128 - Pushing a git repo to GitHub using Python's subprocess returns exit code 128 在 python 中验证 Github 私有仓库 - Autheticate Github private repo in python 错误:命令'gcc'失败,退出状态1安装Fatiando(Python包) - error: command 'gcc' failed with exit status 1 installing Fatiando (Python Package) 运行Python Cookiecutter以从GitHub中获取模板的结果为subprocess.CalledProcessError,返回非零退出状态128 - Running Python Cookiecutter to get template from GitHub results in subprocess.CalledProcessError, returned non-zero exit status 128 从带有 python 的私有 github 仓库下载资产 - Download asset from private github repo with python 私有Github python repo无法安装 - Private Github python repo cannot be installed 退出状态为 128 的子进程调用 - Subprocess call with exit status 128 “错误:命令出错,退出状态为 1:python。” 为 Python 安装简单音频时 - “ERROR: Command errored out with exit status 1: python.” when installing simple audio for Python Python 2.7.7软件包安装给出Visual C ++ cl.exe错误:命令失败,退出状态为2 - Python 2.7.7 package installation giving Visual C++ cl.exe error: command failed with exit status 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM