비표준 포트에서 SSH를 사용하여 SVN/SSH를 구성하는 방법은 무엇입니까?

비표준 포트에서 SSH를 사용하여 SVN/SSH를 구성하는 방법은 무엇입니까?

SSH를 포트 20000으로 구성했습니다. 내가 시도할 때:

svn co svn+ssh://server.com:20000/home/svn/proj1 proj1 --username jm

알겠어요

svn: To better debug SSH connection problems, remove the -q option
from 'ssh' in the [tunnels] section of your Subversion configuration
file. svn: Network connection closed unexpectedly

SVN에게 포트 20000을 사용하라고 지시해야 할까요?

우분투 11.10을 사용하고 있습니다

답변1

Subversion 구성에서 새로운 "터널"( )을 정의할 수 있습니다 ~/.subversion/config. 해당 섹션을 찾아 [tunnels]다음을 정의합니다.

[tunnels]
foo = ssh -p 20000

그런 다음 URL을 통해 저장소에 접속할 수 있습니다 svn+foo://server.com/home/svn/proj1 proj1.

답변2

기본이 아닌 포트에서 또는 다른 사용자 이름을 사용하여 SSH 서버에 액세스해야 할 때마다 다음에서 별칭을 정의할 수 있습니다.~/.ssh/config.

Host mysvn
HostName server.com
Port 20000
User jm

그런 다음 svn co svn+ssh://mysvn/home/svn/proj1.

답변3

어떤 이유로 ~/.subversion/config파일을 편집할 수 없는 경우 명령줄에서 포트를 지정할 수 있습니다.

svn co svn+ssh://joe@myserver/myrepo/ --config-option="config:tunnels:ssh=ssh -p 20000"

그러나 svn이 옵션은 명령이 실행될 때마다 실행되어야 합니다. 이는 에이전트를 구축하는 데 적합할 수 있습니다.

답변4

~/.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 터널을 정의합니다. 이 경우 구성 파일이 우선 적용됩니다. (이것은 매우 특이한 현상입니다. 일반적으로 그 반대가 사실이며 환경 변수는 일반적으로 구성 파일보다 우선합니다.)

관련 정보