Skip to content

Instantly share code, notes, and snippets.

@eslam-mahmoud
Created July 18, 2018 06:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eslam-mahmoud/35777e4382599438023abefc9786a382 to your computer and use it in GitHub Desktop.
Save eslam-mahmoud/35777e4382599438023abefc9786a382 to your computer and use it in GitHub Desktop.
//add your EC2 .pem file to ssh kys
ssh-add ~/aws/mypemfile.pem
//create bare repo on AWS EC2 webserver and deploy on demand
mkdir ~/git/the_project
cd ~/git/the_project
git init --bare
//create local repo and track remote one
cd ~/git/the_project
git init
git add .
git commit -m "Initial git commit message"
git remote add aws ubuntu@1.1.1.1:~/git/the_project
git config --global remote.origin.receivepack "git receive-pack"
git push aws master
//create tag
git tag -a v0.1 -m "my version 0.1"
//push tags
git push aws --tags
//Or you have one so you push your updates
git remote add aws ubuntu@1.1.1.1:~/git/the_project
git config --global remote.origin.receivepack "git receive-pack"
git push aws master
//create tag
git tag -a v0.1 -m "my version 0.1"
//push tags
git push aws --tags
//on server create another local repo that track the bare one to deploy
git clone ~/git/the_project
cd ./the_project
//checkout tag
git checkout v0.1
//install clear cache ...
npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment