pip install -e svn+ssh 不带用户

pip install -e svn+ssh do not take the user

如果我这样做:

svn co svn+ssh://svn@10.210.1.24/cidb/V1/trunk/config cidb_config_pipenv

有效,但如果我这样做:

pip install -e svn+ssh://svn@10.210.1.24/cidb/V1/trunk/config#egg=cidb_config_pipenv

Obtaining cidb_config_pipenv from svn+ssh://svn@10.210.1.24/cidb/V1/trunk/config#egg=cidb_config_pipenv

它去掉了 'svn@' :

Checking out svn+ssh://10.210.1.24/cidb/V1/trunk/config to /root/.virtualenvs/root-PB1MQnVC/src/cidb-config-pipenv

因此它尝试用 'svn' 以外的其他用户登录 svn 服务器,但失败了。

在 pip 文档中,我看到可以使用 svn+ssh 但没有示例:我是否使用正确的语法来指定用于登录 svn 服务器的用户?

编辑:我找到的唯一解决方案是在 ~/.subversion/config 中的 SSH 隧道定义中强制使用用户名:

[tunnels]
ssh = ssh -l svn

这真的很难看,但它确实有效。

svn+ssh 使用不同的 (ssh) authentication,所以正常的 --username 身份验证不起作用。要避免 pip--username 传递给 svn,您必须避免 svn@ 在 URL 中。要传递正确的 ssh 密钥,您必须重新定义 ssh 命令。类似的东西(提供真实密钥的路径):

SVN_SSH="ssh -i $HOME/.ssh/id_dsa.svn"

你的情况可能是

SVN_SSH="ssh -l svn"
export SVN_SSH

验证它是否有效:

svn co svn+ssh://10.210.1.24/cidb/V1/trunk/config cidb_config_pipenv

运行 点:

pip install -e svn+ssh://10.210.1.24/cidb/V1/trunk/config#egg=cidb_config_pipenv

当进入详细模式时,可以看到 pip 正在使用 --username 调用 svn checkout。但那是不起作用的SVN。

svn checkout --username myuser svn+ssh://host/path

不起作用(至少在 ubuntu 和 centos 上):用户名未被考虑在内。 SVN 只接受:

svn checkout svn+ssh://myuser@host/path

我发现的技巧:使用“%40”而不是“@”,因此 pip 不会在 url 中检测到用户名,并且不会使用 --username 选项调用 svn。 所以现在我可以做:

pip -e svn+ssh://myuser%40host/path#egg=myproject

它很难看,可能我必须为 pip 打开一个问题 and/or svn ...