Subversion
This post will contain a summary of information regarding subversion scattered from old posts.
Installation on Debian
- Packages
#apt-get install subversion #apt-get install libapache2-svn |
- Login as root then create the repository.
#cd /data #svnadmin create /repos --fs-type fsfs |
- Set the permissions
#groupadd subversion #addgroup rupert subversion #addgroup www-data subversion #chown -Rf www-data:subversion /data/repos #chmod -Rf 770 repos |
It’s better to set the necessary users and groups that would use subversion now. Later on, if we need to checkout using svn+ssh and setup a passwordless svn, then we won’t get permission issues.
- In /etc/apache2/sites-available/2rmobile, add this to the configuration.
<Location /repos> DAV svn SVNPath /data/repos SVNAutoversioning on AuthType Basic AuthName "SVN - Your Project" AuthUserFile /data/svn-auth-file Require valid-user </Location> |
- Enable the webdav module then restart apache.
#a2enmod dav #a2enmod dav_svn #/etc/init.d/apache2 restart |
Passwordless SVN
On your local macbook pro (mbp), we need to generate the ssh keys from the local machine, upload it to the remote machine and append it in the authorized_keys.
On the local machine:
#ssh-keygen -t rsa ... #cd /Users/rupert/.ssh #scp -r id_rsa.pub rupert@2rmobile.com:/home/rupert/.ssh/id_rsa_mbp.pub |
On the remote machine:
#cd ~/.ssh #touch authorized_keys #cat id_rsa_mbp.pub >> authorized_keys |
Test on the local machine by doing
ssh rupert@2rmobile.com |
. In my mbp, a dialog box from keychain is asking for the password. To circumvent this, we can add the passphrase to our identities.
#ssh-add -K ... enter the passphrase twice... #ssh-add -k (adds it to the identities) #ssh-add -l (lists the identities) |
Now the benefits of having a passwordless svn:
– ofcourse it saves us a lot of time
– rails capistrano deployment
References:
http://www.howtoforge.com/debian_subversion_websvn
Subversion Tips and Tricks
http://subversion.tigris.org/faq.html#ssh-authorized-keys-trick
**1. Checking out using svn+ssh and having passwordless ssh authentication. My personal favorite when working with personal projects since I have full control. **
svn co svn+ssh://www.2rmobile.com/data/repos/web/rails/halalan2010 halalan2010
But for work projects, I normally use webdav
svn co "http://www.2rmobile.com/repos/web/halalan2010" halalan2010
2. svn+ssh on a custom or different port other than 22. I have my ssh on 2210, so we need to tell svn+ssh to use 2210
vim ~/.subversion/config 41 [tunnels] 42 ### Configure svn protocol tunnel schemes here. By default, only .... 53 ### built-in ssh scheme were not predefined, it could be defined 54 ### as: 55 ssh = $SVN_SSH ssh -p 2210 |
http://www.techper.net/2009/01/11/changing-port-number-of-svnssh-subversion-protocol/
3. svn diff – shows you the changes in a directory. This is useful for creating patches.
svn diff -r HEAD svn st -q
**3. svn switch oldURL to newURL **- very useful when I’m working at home or in the office, since the svn server has a public/private IP.
4. svn log – shows you who committed and why (from the messages)
**5. ignoring specific set of files in a directory. **
svn propset svn:ignore "*.log" log
6. ignoring a whole directory.
svn propset svn:ignore dirname .
7. ignoring using an ignore file (.ignore.txt) in a directory (sample.xcodeproj).
*.pbxuser *.mode1v3 xcuserdata
svn propset svn:ignore - F .ignore.txt .