[Practice 2] Clone Existing Repo to AWS EC2

Allie Hsu
Coder Life
Published in
4 min readJun 30, 2020

--

Co-author: Eileen Chu

Photo by Caleb White on Unsplash

In this practice, you will follow the steps below:

  • Add your website files to Git Repo
  • Launch an EC2 Instance through the AWS Console
  • SSH to EC2 Instance & Install a Web Server
  • Install Git on the EC2 Instance
  • Clone a Repo from Git onto the EC2 Instance

Add your website files to Git Repo

Before adding, you will have to create a new repo on your GitHub. On your local machine, initialize a Git directory:

$ git init

To check the state of the working directory and the stage area, enter:

$ git status

Then add the entire project under git tracking:

$ git add .

Now you can commit the file:

$ git commit -m “this is my first commit”

Your site is now under version control.

$ git remote add origin <repo URL>

And Push the changes in your local repository to GitHub if needed.

$ git push -u origin master    # before Oct 2020
or
$ git push -u origin main # after Oct 2021

--

--

Allie Hsu
Coder Life

A tech enthusiast who is keen to develop new skills