Tuesday, September 20, 2011

how to make a git server on AWS CE2

On your aws ec2 server:

1. make an user account called "git"
2. $ su git
3. $ cd /home/git
4. $ mkdir test.git
5. $ cd test.git
6. $ git --bare init Initialized empty Git repository in /home/git/test.git/
7. $ pwd /home/git/test.git

then back to local site.

1. $ mkdir test
2. $ cd test
3. $ touch me
4. $ ls me
5. $ git init Initialized empty Git repository in /tmp3/test/.git/
6. $ git add .
7. $ git commit -m 'init' [master (root-commit) f16acd9] init Committer: ming Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
git config --global user.name "Your Name" git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name '
0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 me
8. $ git log commit f16acd95a84465a9cbf7ed7f9acacb6362724a30 Author: ming Date: Tue Sep 20 23:06:07 2011 +0800
init
9. $ git branch -a * master
10. git remote add origin git@url0.info:test.git
11. $ git push origin master Counting objects: 3, done. Writing objects: 100% (3/3), 197 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To git@url0.info:test.git * [new branch] master -> master
12. $ git branch -a * master remotes/origin/master
13. $ git status # On branch master nothing to commit (working directory clean)
14. $ git pull origin master From url0.info:test * branch master -> FETCH_HEAD Already up-to-date.

Remarks: make sure you can ssh the server by the git account before hand.

No comments:

Post a Comment