简体   繁体   中英

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

I am on Windows 10 running Python 3.7.

I am trying to install a Python package on one of my private GitHub repositories. I want to use the GitHub deploy key to give only read access to the single repository.

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. I then copied the public key to the deploy keys for my private GitHub python package repository.

Then I generated a virtualenv and tried to run the command

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:

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

It turns out that I needed to ensure that my ssh key was being used . I did so by following the directions on the github site which suggested that I run this command :

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. I'd tried all sorts of different solutions and was getting very discouraged about it because my linux setup worked fine! It was windows 10 that seemed to be giving me trouble.

After that I was able to pip install from github using the powershell inside of vscode (with a venv enabled).

I originally thought that the issue was my sshkey (that I'd pasted it wrong) but that wasn't the case. I also thought it might have been something with visual studio code but that wasn't the case either. 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. I have 2 ssh keys enabled (laptop and desktop) for my private repo and use it to pip install packages from there.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM