如果你的〜/的.subversion / config文件不具有SSH隧道定义,你可以使用SVN_SSH环境变量在每次呼叫的基础覆盖ssh命令
SVN_SSH='ssh -p 20000' svn co svn+ssh://server.com/home/svn/proj1 proj1 --username jm
例如
deo@fox:~$ SVN_SSH='ssh -v -p 20000' svn ls svn+ssh://svn/
OpenSSH_7.9p1 Debian-10, OpenSSL 1.1.1c 28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to svn [192.168.177.2] port 20000.
debug1: connect to address 192.168.177.2 port 20000: Connection refused
ssh: connect to host svn port 20000: Connection refused
svn: E170013: Unable to connect to a repository at URL 'svn+ssh://svn'
svn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: E210002: Network connection closed unexpectedly
如果〜/ .subversion / config文件确实定义了ssh隧道,则此方法将不起作用,在这种情况下,配置文件优先。(这很不寻常。通常情况相反,环境变量通常优先于配置文件)
svn+ssh
协议的端口,只需定义即可ssh = ssh -p 20000
。假设您已经/etc/ssh/sshd_config
在服务器上进行了修改,以Port 22
代替Port 20000
。