Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active July 29, 2020 19:33
Show Gist options
  • Save grenade/6317840 to your computer and use it in GitHub Desktop.
Save grenade/6317840 to your computer and use it in GitHub Desktop.
Install Gitolite and grant yourself access on Fedora / RedHat
# create git user and ssh keys
sudo adduser --system --create-home --shell /bin/bash --comment 'git version control' git
sudo su - git -c 'mkdir -m=700 ~/.ssh'
sudo su - git -c 'ssh-keygen -t rsa -C "git@$(hostname)" -N "" -f ~/.ssh/id_rsa'
sudo su - git -c 'chmod 600 ~/.ssh/id_rsa'
sudo su - git -c 'chmod 644 ~/.ssh/id_rsa.pub'
# install gitolite, set umask and run setup
sudo yum install -y gitolite
sudo sed -i 's/0077/0007/g' /usr/share/gitolite/conf/example.gitolite.rc
sudo su - git -c 'gl-setup -q ~/.ssh/id_rsa.pub'
cd /tmp
sudo -u git -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin
sudo chmod -R a+w /tmp/gitolite-admin
cp ~/.ssh/id_rsa.pub /tmp/gitolite-admin/keydir/$(whoami).pub
cd /tmp/gitolite-admin
sudo -u git -H git add .
cat > /tmp/gitolite-admin/conf/gitolite.conf <<EOF
repo gitolite-admin
RW+ = id_rsa
RW+ = $(whoami)
repo testing
RW+ = @all
RW+ = $(whoami)
EOF
sudo -u git -H git add .
sudo -u git -H git commit -a -m "Granted git user access."
sudo -u git -H git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment