Last active
October 1, 2015 10:37
-
-
Save edwardteach42/1975320 to your computer and use it in GitHub Desktop.
Host a git repository on Amazon EC2
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
Set Up CentOS Server | |
Use Rightscale CentOS Community Server Image ami-09496d4c | |
*****AS ROOT***** | |
$ yum update | |
$ yum install git mysql mysql-libs httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-mcrypt | |
$ echo 'service httpd restart' >> /etc/rc.local | |
$ ssh-keygen -t rsa -C "[email protected]" | |
$ useradd git | |
$ passwd git | |
$ cd /home/git | |
$ mkdir .ssh | |
$ cat ~/.ssh/id_rsa.pub >> .ssh/authorized_keys | |
$ chown git:git .ssh | |
$ chown git:git .ssh/authorized_keys | |
$ chown git:git /var/www/html/ | |
Setup the remote repository on the EC2 Instance: | |
$ ssh [email protected] | |
$ mkdir my_project.git | |
$ cd my_project.git | |
$ git init --bare | |
$ cat > hooks/post-receive | |
#!/bin/sh | |
GIT_WORK_TREE=/var/www/html git checkout -f | |
$ chmod +x hooks/post-receive | |
On local machine: | |
$ cd my_project | |
$ git init | |
$ git add * | |
$ git commit -m "My initial commit message" | |
$ git remote add origin [email protected]:my_project.git | |
$ git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment