Tuesday, 3 January 2012

svn commit helper without using svn agent. no auth cache

Use svn agent to store svn credentials securely and avoid having to enter username and password multiple times. But if setting up svn agent is not practical and password security is not an issue this svnci alias and getmysvndetails script can be used to help do checkins and NOT update svn stored passwords.

p.s. aliases are deprecated :) svnci should be a bash function or script also

cat getmysvndetails
#!/bin/bash

# svn client use results in svn credentials being re-written to svn cache by svn client
# the last username entered becomes the default (even if password not stored in cache)
# use this alias to assist working as different svn users in the same unix/other user accounts
#alias svnci='. getmysvndetails; svn ci --username $MYSVNUSER --password $MYSVNPASS --no-auth-cache'

if [[ $0 == $BASH_SOURCE ]] ; then echo "This script must be sourced. Try again:"; echo " . $0"; exit; fi

if [[ "$MYSVNUSER" == "" ]] ; then
  read -p "Enter SVN username: " MYSVNUSER ;
fi

if [[ "$MYSVNPASS" == "" ]] ; then
  read -p "Enter SVN password: " MYSVNPASS ;
fi

export MYSVNUSER
export MYSVNPASS

No comments: