Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is usually not a good idea to push code directly to a live website. For this you can create a bare repository on your server, outside the public directory. This repository will push changes to your Live website repository and will be like the gate keeper for your Website. To set things up, create a repository around your live website directory:</p> <pre><code>$ cd ~/www $ git init $ git add . $ git commit -m"initial import of pre-existing web files" </code></pre> <p>With this created, move to a directory not accessible via HTTP. To keep things simple,lets call this bare directory HUB and the website directory LIVE. Initialize a bare repository here:</p> <pre><code>$ cd; mkdir site_hub.git; cd site_hub.git $ git --bare init </code></pre> <p>Then, from inside your live website working directory, add this bare repository as a remote and push live website’s master branch. </p> <pre><code>$ cd ~/www $ git remote add hub ~/site_hub.git $ git remote show hub * remote hub URL: /home/rizwan/site_hub.git $ git push hub master </code></pre> <p>You need hooks to commit changes to the live repository. Create a <code>post-update</code> hook inside the HUB repository :</p> <pre><code>#!/bin/sh echo echo "**** Pulling changes into Live [Hub's post-update hook]" echo cd $HOME/www || exit unset GIT_DIR git pull hub master exec git-update-server-info </code></pre> <p>Inside this hook, you can have the code to restart the server after the pull is completed.</p> <p>Also, create a <code>post-commit</code> hook on the LIVE repo to send changes done to the live website back to HUB.</p> <pre><code>#!/bin/sh echo echo "**** pushing changes to Hub [Live's post-commit hook]" echo git push hub </code></pre> <p>On your local machine, add the HUB repository as a remote and push changes to it:</p> <pre><code>git remote add hub &lt;hub-repository-url&gt; </code></pre> <p>How this works is, you write some code and push it to the bare repository, which using its post-update hook to push changes to the live respository and restart the server.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload