通过ssh使用svn

通过ssh来存取svn仓库自然是很方便的,不用架设webdav服务器,不用多侦听一个端口等等,一般的可以这样:

svn co svn+ssh://host/path/to/svn/repos

如果ssh不工作在默认的22端口上,如2222,有两个办法解决。

设置SVN_SSH变量:

export SVN_SSH="ssh -p 2222"

编辑~/.subversion/config,其中有tunnel一节,加入:

proa = ssh -p 2222

然后就可以这样用了:

svn svn+proa://host/path/to/svn/repos

如果遇到错误"bash: svnserve: command not found",是因为svn调用ssh后得到是非登陆shell。可以试着在放置svn仓库的服务器上加入相关路径到.bashrc,或者给svnserve在/usr/bin下面加个符号链接,确保非登陆shell可以找到svnserve。也可以搞的很复杂:

生成一个新的ssh密钥对,用下面的格式把公钥放到svn服务器上

command="/full/path/to/svnserve -t" TYPE KEY COMMENT

客户机上安上面指定端口的方法指定svn用特定的私钥

export SVN_SSH="ssh -p 2222 -i /home/dude/.ssh/id_svn_only"

这样svn在通过ssh隧道连接时就可以启动svnserve了。

大约需要的人早找到了英文的资料,不过我想用中文写出还是有人会看的。为什么还要用svn这么土的东西?当然是历史原因了。

This entry was posted in tech. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Kang
    Posted 2008-11-13 at 15:29 | Permalink

    who is me ?
    这个用法是明显错误的,可以类比一下,如果说他是谁,是不是要说
    who is he ?
    有人会说
    who is him ?
    吗?

  2. George
    Posted 2008-11-13 at 16:14 | Permalink

    囧… 我只是为了好玩

  3. Posted 2008-11-30 at 21:55 | Permalink

    那就叫 who is xsh

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>