代码之家  ›  专栏  ›  技术社区  ›  Eric

pip安装-e svn+ssh不接受用户

  •  1
  • Eric  · 技术社区  · 7 年前

    如果我这样做:

    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服务器的用户?

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

    [tunnels]
    ssh = ssh -l svn
    

    这真的很难看,但很管用。

    2 回复  |  直到 7 年前
        1
  •  3
  •   Eric    7 年前

    当进入详细模式时,可以看到pip正在使用--用户名调用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和/或svn打开一个问题。。。

        2
  •  1
  •   phd    7 年前

    svn+ssh 使用不同的 (ssh) authentication 很正常 --username auth不起作用。避免 pip 通过 --用户名 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:

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