Skip to content

Instantly share code, notes, and snippets.

@roderik
Created June 21, 2010 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roderik/446797 to your computer and use it in GitHub Desktop.
Save roderik/446797 to your computer and use it in GitHub Desktop.
#!/bin/bash
SERVER="gitadmin@git.kunstmaan.be"
while getopts "s:" OPTION
do
case $OPTION in
s)
SERVER=$OPTARG
;;
esac
done
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
fi
if [ -f ~/.ssh/id_dsa.pub ]; then
echo "Ssh key found"
else
echo "Please save your ssh key in ~/.ssh/id_dsa.pub"
ssh-keygen -d
fi
keyname=`cat ~/.ssh/id_dsa.pub | cut -d" " -f 3`
if [ -f ~/.ssh/${keyname}.pub ]; then
rm ~/.ssh/${keyname}.pub
fi
cp ~/.ssh/id_dsa.pub ~/.ssh/${keyname}.pub
scp -C ~/.ssh/${keyname}.pub ${SERVER}:~/gitosis-admin/keydir/
user=`whoami`
ssh ${SERVER} "cd ~/gitosis-admin/; ~/gitosis-admin/manage -u $user"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment