Push code on AWS or Digital Ocean with the use of Hook
Login to your VPS from command line and type the following:
cd /var
mkdir repo
cd repo
mkdir site.git
cd site.git
git init --bare
cd hooks
touch post-receive
nano post-receive
copy below line 2 lines into post-recieve and change both path
#!/bin/sh
git --work-tree=/var/www/domain. com --git-dir=/var/repo/site.git checkout -f
Change permission of post-receive file
chmod +x post-receive
Your Local System:
cd /my/workspace
mkdir project && cd project
git init
git remote add hemant ssh://user@mydomain.com/var/ repo/site.git
git add .
git commit -m "My project is ready"
git push hemant master
and run the following command to add ssh key to your server -
cat ~/.ssh/id_rsa.pub | ssh -i /home/hemant/Desktop/test-runner.pem
ubuntu@52.35.102.26 "mkdir -p ~/.ssh && cat >>
~/.ssh/authorized_keys"
Note: Guys If you have doubt here, Please ask me friendly...
Thanks,
Hemant gupta
No comments:
Post a Comment