Skip to content

Instantly share code, notes, and snippets.

@SuperSarkar
Last active June 26, 2018 03:58
Show Gist options
  • Select an option

  • Save SuperSarkar/b54ca5c7a8b49450cf07d04e9680f225 to your computer and use it in GitHub Desktop.

Select an option

Save SuperSarkar/b54ca5c7a8b49450cf07d04e9680f225 to your computer and use it in GitHub Desktop.

Revisions

  1. SuperSarkar revised this gist Jun 26, 2018. 1 changed file with 31 additions and 1 deletion.
    32 changes: 31 additions & 1 deletion Deploy Static Website Using Git.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,40 @@
    1. Create a Bare Repo on Server

    ```ssh kunal@domain.com
    ```
    ssh kunal@domain.com
    mkdir website.git
    cd website.git
    git init --bare
    ```

    2. Create a Hook to copy files from the bare git directory to the nginx/apache website directory

    ```
    cd hooks
    mv post-update.sample post-update
    nano post-update
    ```

    Update the "post-update" hook with following content:

    ```
    git --work-tree=/var/www/html/domain.com/public_html --git-dir=/home/kunal/website.git checkout -g
    ```

    3. Initialize the local repo:

    ```
    cd proj
    git init
    git add .
    git commit -m "First commit"
    ```

    4. Push to Server

    ```
    git remote add origin kunal@ipaddress:/home/kunal/website.git
    git push origin master
    ```

    If you are using SSH keys to login to the server, make sure "pageant" is running with the keys added to it.
  2. SuperSarkar revised this gist Jun 26, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Deploy Static Website Using Git.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,8 @@
    ```ssh kunal@domain.com
    mkdir website.git
    cd website.git
    git init --bare```
    git init --bare
    ```

    2. Create a Hook to copy files from the bare git directory to the nginx/apache website directory

  3. SuperSarkar revised this gist Jun 26, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Deploy Static Website Using Git.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    1. Create a Bare Repo on Server

    `ssh kunal@domain.com
    ```ssh kunal@domain.com
    mkdir website.git
    cd website.git
    git init --bare`
    git init --bare```
    2. Create a Hook to copy files from the bare git directory to the nginx/apache website directory
  4. SuperSarkar revised this gist Jun 26, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Deploy Static Website Using Git.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    1. Create a Bare Repo on Server

    `ssh kunal@domain.com`
    `mkdir website.git`
    `cd website.git`
    `git init --bare`
    `ssh kunal@domain.com
    mkdir website.git
    cd website.git
    git init --bare`

    2. Create a Hook to copy files from the bare git directory to the nginx/apache website directory

  5. SuperSarkar created this gist Jun 26, 2018.
    9 changes: 9 additions & 0 deletions Deploy Static Website Using Git.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    1. Create a Bare Repo on Server

    `ssh kunal@domain.com`
    `mkdir website.git`
    `cd website.git`
    `git init --bare`

    2. Create a Hook to copy files from the bare git directory to the nginx/apache website directory