svn+ssh

According to official document, svn+ssh is supposed to be somehow faster than apache+dav_svn, however based on my setup, it's slower.



# install subversion if missing

sudo apt-get install subversion



# add a system user for all incoming ssh connections

useradd -m svnuser



# create the SVN repository

 sudo svnadmin create /var/svn/repoOne

 sudo chown -R svnuser repoOne

 svnuser will be essentially the account to interact with svnserve, so need to grant it all the relevant permissions to the repositories.



# Create Keys using ssh-keygen and append pub key to authorized_keys of the user above



ssh-keygen -b 1024 -t dsa -N passphrase -f keyfile



cat keyfile.pub >> /home/svnuser/.ssh/authorized_keys



# download the key to local(say windows), convert the private key using putty for later tortoisesvn client to use.

# or can create locally first using puttygen and then upload it server and do the attach of pub key, both ways works(make sure delete the first line and last line in the pub key if generated using puttygen)



# edit the command in authorized_keys



vi /home/svnuser/.ssh/authorized_keys

## find the line whose pub key is specically for svn access, update it as below for example:

command="/usr/bin/svnserve -t -r /var/svn --tunnel-user=userOneWhoDoesCheckIn" ssh-rsa [pub key] [optional comment]

## note:

1. userOneWhoDoesCheckIn is the user who will appear on the svn audit info, but actually it delegates operation to svnuser.

2. command here can be complex, e.g. you might want to specify some additional options here:

no-port-forwarding,no-agent-forwarding,no-X11-forwarding, no-pty



# download pageant.exe from putty official website if missing.

# add the private key into pageant.exe(client authentication depends on it, so it needs to be running before any client svn access)

# note: if you had previously specified a password for the ssh key, then here you will be prompted to input the same pwd here when adding.



# put below link into tortoisesvn

svn+ssh://svnuser@serverIPAddress/repoOne

the first time you will be prompted to cache the pub key, choose yes, so you won't be any more.

Reference:

http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.serverconfig.choosing.svn-ssh

http://tortoisesvn.net/ssh_howto.html

上一篇:Sqlserver获取所有数据库名,表信息,字段信息,主键信息,以及表结构等。


下一篇:Vue源码解析(二):数据驱动