如何发现"pip install git + ssh://..."在哪里搜索ssh密钥? [英] How to discover where 'pip install git+ssh://...' is searching for ssh keys?

查看:217
本文介绍了如何发现"pip install git + ssh://..."在哪里搜索ssh密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否有一种简单的方法来发现pip install git+ssh:///...在哪里搜索ssh密钥吗?

Does anyone know if there's a simple means of discovering where pip install git+ssh:///... is searching for ssh keys?

我在Windows 10上.我需要在conda虚拟环境中使用pip从github安装一个私有远程存储库.我是仓库的所有者.我有一个通过github.com设置的公共/私有ssh密钥对.我的本地密钥存储在C:\Users\MyName\\.ssh\id_rsa中.使用此键,我可以使用我的IDE(Eclipse)从github进行推入和拉出操作.

I am on Windows 10. I needed to install a private remote repository from github using pip in a conda virtual environment. I am the repo owner. I have a public/private ssh key pair set up through github.com. My local key is stored in C:\Users\MyName\\.ssh\id_rsa. Using this key I am able to push and pull without issue from github using my IDE, Eclipse.

但是,当我使用激活的conda环境执行以下命令时:

However, when I executed the following command using my activated conda environment:

pip install git+ssh://github.com/USER_NAME/REPO_NAME.git

我遇到以下错误:

Collecting git+ssh://github.com/USER_NAME/REPO_NAME.git
Cloning ssh://github.com/USER_NAME/REPO_NAME.git to
c:\users\USER_NAME\appdata\local\temp\pip-ghf3ts-build
Warning: Permanently added 'github.com,IP_ADDRESS' (RSA) to the list of
known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我知道该存储库存在,并且我知道ssh密钥可以正常工作;因此,我假设未正确配置任何ssh例程pip调用.

I know that the repo exists, and I know the ssh key works fine; so, I assumed whatever ssh routine pip was calling was not properly configured.

从那时起,我已经解决了这个问题,并且不良配置"假设被证明是正确的!我向C:\ Users \ MyName \ .ssh添加了一个配置文件,指定了要使用的文件. Wham-bam,它现在很好用.

I have solved this issue since then, and the 'bad configuration' assumption proved to be correct! I added a config file to C:\Users\MyName\.ssh specifying which file to use. Wham-bam, it works great now.

但是!我仍然想知道是否仍然可以确认pip在该目录中查找ssh密钥和配置.所以,我暂时不提这个问题.

However! I would still be interested in knowing if there were anyway to have confirmed that pip was looking in that directory for ssh keys and configs; so, I'll leave this question open for now.

推荐答案

GIT_SSH_COMMAND 环境变量使您可以覆盖Git用于运行ssh的命令.在这种情况下,您要启用详细输出.在Windows上看起来像这样:

The GIT_SSH_COMMAND environment variable enables overriding the command that Git uses to run ssh. In this case, you want to enable verbose output. On Windows this looks like:

set GIT_SSH_COMMAND=ssh -v

然后,当您运行pip install git+ssh://github.com/USER_NAME/REPO_NAME.git时,ssh会输出调试信息,包括它在哪里寻找密钥的信息:

Then when you run pip install git+ssh://github.com/USER_NAME/REPO_NAME.git, ssh outputs debug information, including where it looks for keys:

...
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.253.112] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/MyName/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
...

这篇关于如何发现"pip install git + ssh://..."在哪里搜索ssh密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆