Part 1: Connect to your Amazon EC2 Ubuntu instance and run the following commands to install git
1. Navigate to the home directory:
2. Use apt-get to install git-core:
sudo apt-get -y install git-core
3. Set up the git user:
git config --global user.name "John Smith"
git config --global user.email email@example.com
4. Make a directory for the git repository, navigate to it, and initialise it with --bare
git init --bare
Part 2: Clone your git repository locally to initialise it
1. Open Putty to SSH to your EC2 instance and "Allow Agent Forwarding" in the settings for the connection so that you can authenticate through a second ssh session (this is to perform the clone which will create a local repository on the EC2 machine). See image below (Connection --> SSH --> Auth)
2. Make a new directory for the git clone
3. Initialise the git repository for the clone folder
git remote add origin ssh://ubuntu@localhost/test_repo.git
Part 3: Setup the connection from SourceTree on your Windows computer
1. Add your private key to the Pageant tool in the task bar (it is installed with SourceTree)
2. In Source Tree click 'Clone/New'
3. In the Source Path/URL enter a connection formatted similar to below:
If all ok, the 'Repository Type' should say "This is a git repository". If not, try going to your test_repo.git folder and type "git status" to see if the repository is having any problems.
4. Set the Destination Path to a folder on your local computer where you want your local git repository to be located.
5. Click "Clone" when done.
Note: To be updated in future with more screenshots & better descriptions.
https://bitbucket.org/ (free private repo for up to 5 users - alternative to github which is only free if your repo is public). Not required for git, only if you want a third party to also host your repo.
http://git-scm.com/documentation - Git Documentation