cd /var
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
cd hooks
cat > post-receive
#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
Press: ctrl + d (saving to file)
chmod +x post-receive
Last active
September 21, 2020 04:49
-
-
Save shrestharikesh/0fb694ba1979a0ad3b807b549f3cd1d3 to your computer and use it in GitHub Desktop.
Automatic deployment with GIT in a VPS. Create a git hook on VPS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /my/workspace | |
mkdir project && cd project | |
git init | |
git remote add live ssh://user@mydomain.com/var/repo/site.git | |
git add . | |
git commit -m "My project is ready" | |
git push live master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment