Created
August 8, 2014 19:06
-
-
Save Tantas/209a3bf82402561d6b32 to your computer and use it in GitHub Desktop.
Install gitolite to an Amazon AMI server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install gitolite to an Amazon AMI server | |
# Allows a low-spec ec2 machine to be used | |
#=============================================================================== | |
# Install gitolite | |
#=============================================================================== | |
# Create the git user | |
sudo adduser git | |
# Set the git user's password | |
sudo passwd git | |
# Install gitolite | |
sudo yum install -y gitolite | |
# Switch user to git | |
sudo su - git | |
# Create the key | |
# Will leave the private key on the server incase loose | |
ssh-keygen -t rsa -f ~/.ssh/gitadmin | |
# Use the key to setup gitolite | |
gl-setup ~/.ssh/gitadmin.pub | |
# Switch to client machine | |
# Copy the private component of the key to your local machine and install | |
# cat ~/.ssh/gitadmin and paste into vim ~/.ssh/gitadmin works well | |
# Create a nice ssh host for the ssh config for the git administrator | |
vim ~/.ssh/config | |
#host gitadmin | |
# user git # the user should be the same as the gitolite user | |
# hostname xxx.xxx.xxx.xxx | |
# port 22 | |
# identityfile ~/.ssh/gitadmin | |
# Check if the connection works | |
ssh gitadmin info | |
# Clone the admin directory | |
git clone ssh://gitadmin/gitolite-admin | |
#=============================================================================== | |
# Create the user for accessing git | |
#=============================================================================== | |
# Create each user by executing the following on the user's machine | |
ssh-keygen -t rsa -f ~/.ssh/joeprivategit | |
# Place the public key into the gitolite administration keydir | |
cp ~/.ssh/joeprivategit.pub gitoliteadmin/keydir/joe.pub | |
# Add the user joe to the repositories for access | |
# Push the configuration back to the server | |
git add conf* keydir* | |
git commit -m "Added user joe." | |
git push | |
# Create a nice ssh host in the ssh config for the git connection | |
vim ~/.ssh/config | |
#host privategit | |
# user git # the user should be the same as the gitolite user | |
# hostname xxx.xxx.xxx.xxx | |
# port 22 | |
# identityfile ~/.ssh/joeprivate | |
# Check connection and repository access | |
ssh privategit info | |
# Clone a directory with | |
git clone ssh://privategit/repsitoryname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment