簡體   English   中英

Python 安裝私有 github 回購給出“退出狀態 128”錯誤?

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

我在 Windows 10 運行 Python 3.7。

我正在嘗試在我的私人 GitHub 存儲庫之一上安裝 Python package。 我想使用 GitHub deploy key只授予對單個存儲庫的讀取訪問權限。

所以我使用生成了部署密鑰

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

這將私鑰和公鑰添加到我的用戶計算機上的.ssh文件夾中。 然后我將公鑰復制到我的私有 GitHub python package 存儲庫的部署密鑰。

然后我生成了一個virtualenv並嘗試運行命令

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

但我一直收到錯誤提示

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.

我看過其他有類似問題的帖子,據我所知,我的安裝命令語法是正確的。

這是我的錯誤日志 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'

您好,我遇到了同樣的問題!

我找到了答案:

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

事實證明,我需要確保我的 ssh 密鑰正在被使用 我按照 github 網站上的指示執行此操作,該網站建議我運行此命令

ssh -vT git@github.com

我運行了這個命令提示符並且它起作用了。 我不知道如何或為什么,但它似乎已將某種配置重置為我的 ssh shell 現在工作的位置。 我嘗試了各種不同的解決方案,但對此感到非常沮喪,因為我的 linux 設置工作正常! 似乎給我帶來麻煩的是 windows 10。

之后,我能夠使用 vscode 內部的 powershell(啟用了 venv)從 github 安裝 pip。

我最初認為問題出在我的 sshkey(我粘貼錯了),但事實並非如此。 我還認為它可能與 visual studio 代碼有關,但事實也並非如此。 然后我認為這可能與我的安全協議有關。 所以我嘗試通過我的防火牆啟用和禁用不同的端口,這些端口在其他論壇中被建議並且也沒有用。

我知道出了問題,因為每當我在桌面上創建一個密鑰時,當我在 Github 上查看我的密鑰時,它永遠不會顯示任何使用活動。但是一旦我運行命令,就會出現綠燈並顯示它最近被激活。 我為我的私人存儲庫啟用了 2 個 ssh 密鑰(筆記本電腦和台式機),並使用它從那里安裝軟件包 pip。

我希望這可以幫助那里的人。 對不起,如果我說得太多了。 這是我的第一篇文章。 我剛找到這個解決方案,不得不分享它,因為我太興奮了!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM