Shihui Guo

Setup A Git Server on Amazon EC2 for single user

This is the easiest way and only works for single user. If you are looking for multiple users, go for some more complex settings.

To make your life easier, add the public key to ssh default:

ssh-add PATH_TO_YOUR_PERM_FILE

make a folder and setup the repo on the server:

mkdri path_to_git_folder
git init --bare reponame

Add the remote path to your existing repo (on your local machine):

git remote add amazon username@ipaddress:/path_to_git_folder/

Then you can push or pull, but just to check if the setting is correct

git remote update

After you pushed something to the remote repo, a good way to test is to try cloning it

git clone username@ipaddress:/path_to_git_folder/

点击查看评论