Skip to content

Instantly share code, notes, and snippets.

@hvnsweeting
Created January 4, 2013 10:58
Show Gist options
  • Save hvnsweeting/4451660 to your computer and use it in GitHub Desktop.
Save hvnsweeting/4451660 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from fabric.api import *
def host():
env.hosts = ["192.168.122.158"]
#env.password = {'[email protected]': 'hehehe', '[email protected]':'hehehe'}
env.passwords = {'[email protected]': 'hehehe', '[email protected]':'hehehe'}
def gitolite():
run('grep "git:" /etc/passwd')
sudo('userdel -f git', warn_only=True)
sudo('rm -rf /home/git', warn_only=True)
sudo('apt-get install -y git')
sudo('useradd -m git')
sudo('passwd git')
with settings(user='git'):
run('cd ~')
run("rm ~/.ssh/authorized_keys", warn_only=True)
run('git clone git://github.com/sitaramc/gitolite.git')
local('scp ~/.ssh/id_rsa.pub git@' + env.hosts[0] + ':/home/git/id_rsa.pub')
run('mkdir -p $HOME/bin')
run('gitolite/install -to $HOME/bin')
run('gitolite setup -pk id_rsa.pub')
run('./gitolite/install -to $HOME/bin')
run('$HOME/bin/gitolite setup -pk id_rsa.pub')
#local('git clone [email protected]:gitolite-admin')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment