To use subversion, first we need to create a repository, on svn server
# svnadmin create /usr/local/scripts
cat <<EOF > /usr/local/scripts/conf/svnserve.conf
anon-access = none
auth-access = write
password-db = passwd
EOF
The rest of the parts are all done on clients:
To add files to subversion repository, we can run
svn import /usr/local/scripts/check_mem.sh \Alternatively, we can check out an SVN copy, update on our local copy, then check in whatever changes done on local copy to SVN repository
svn+ssh://lnxscrpt@linux/usr/local/scripts/check_mem.sh
Adding /usr/local/scripts/check_mem.sh
1. To check out
$ mkdir ~/work; cd ~/work
$ svn co svn+ssh://lnxscrpt@linux/usr/local/scripts
Checked out revision 0.
We will have ~/work/scripts directory now
After we check out, other people may have made some changes to the repository, it's always a good practice to update our local copy before changing anything.
$ svn up scripts
At revision 0.
2. To add check_load.sh, copy check_load.sh to ~/work/scripts, and run
$ svn add scripts/check_load.sh3. Commit our changes:
A scripts/check_load.sh
$ svn ci scripts/
Adding scripts/check_load.sh
Transmitting file data .
Committed revision 1.
4. Make sure check_load.sh is in SVN repository:
$ svn ls svn+ssh://lnxscrpt@linux/usr/local/scripts
check_load.sh
check_mem.sh
5. check svn log
$ svn log svn+ssh://lnxscrpt@linux/usr/local/scripts/check_load.sh
------------------------------------------------------------------------
r1 | lnxscrpt | 2013-09-03 14:25:11 +0800 (Tue, 03 Sep 2013) | 2 lines
added check_load.sh at 2:25pm
------------------------------------------------------------------------
$ svn log svn+ssh://lnxscrpt@linux/usr/local/scripts/check_mem.sh
------------------------------------------------------------------------
r5 | lnxscrpt | 2013-09-03 14:44:38 +0800 (Tue, 03 Sep 2013) | 2 lines
import check_mem.sh
------------------------------------------------------------------------
Note: whenever we svn commands, we will be prompted the password for lnxscrpt@linux, we can set up password ssh login by following: http://linuxscripter.blogspot.com/2012/05/set-up-password-less-ssh-login-using.html
No comments:
Post a Comment