Skip to content

Instantly share code, notes, and snippets.

@ylem
Last active December 2, 2024 17:19
Show Gist options
  • Save ylem/9d43ca29e7887b2d9ffada43f65086da to your computer and use it in GitHub Desktop.
Save ylem/9d43ca29e7887b2d9ffada43f65086da to your computer and use it in GitHub Desktop.

Revisions

  1. ylem revised this gist May 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Setup Automatic Deployment with Git with a VPS.txt
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@
    3. after any changes. remrember "push" to both live and master
    $git push
    then
    $git push live master
    $git push live



  2. ylem revised this gist May 10, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Setup Automatic Deployment with Git with a VPS.txt
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,9 @@
    1. go to your "git" project folder.
    2. $git remote add live ssh://[email protected]/var/repo/site.git
    3. after any changes. remrember "push" to both live and master
    $git push (or $git push live master)
    $git push
    then
    $git push live master



  3. ylem revised this gist May 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Setup Automatic Deployment with Git with a VPS.txt
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@
    1. go to your "git" project folder.
    2. $git remote add live ssh://[email protected]/var/repo/site.git
    3. after any changes. remrember "push" to both live and master
    $git push live master
    $git push (or $git push live master)



  4. ylem created this gist May 10, 2017.
    30 changes: 30 additions & 0 deletions Setup Automatic Deployment with Git with a VPS.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #server side:

    #server live directory: /var/www/domain.com
    #server repository: /var/repo/site.git

    1. clone project from git/bitbucket into /var/www/domain.com or init the folder by "git init".

    2. go to /var/repo/site.git and init the folder as git bare
    $git init --bare
    --bare means that our folder will have no source files, just the version control.

    3. still in site.git folder go to hooks.
    $cd hooks
    $cat > post-receive # When you execute this command, you will have a blank line indicating that everything you type will be saved to this file
    type:
    #!/bin/sh
    git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f

    4. $chmod +x post-receive
    $exit

    #Local workspace:

    1. go to your "git" project folder.
    2. $git remote add live ssh://[email protected]/var/repo/site.git
    3. after any changes. remrember "push" to both live and master
    $git push live master