Pure Daft

Using Git With A Gandi-Hosted Website

05 Oct 2015

I am using Gandi Simple Hosting to host this site. I also use Bluefish editor to create my files, and Jekyll to create the static site that is uploaded. Here are the following steps I took to link them all together (not including setting up Jekyll):

Cleaning Bluefish’s Temporary Files

Bluefish creates files ending with ~ as a backup, so I wanted to remove those files to make sure they did not get committed to git.

To check the files that will be removed:

find . -name '*~'

To delete the same files:

find . -name '*~' -delete

Gandi structure

Gandi requires that the files to be published reside in a subfolder of the repository called htdocs. In this example, the source files, the files used by Jekyll to create the site, are also committed to Gandi’s git repository, but will not be committed to a public location.

Structure the site by moving my source files into a subfolder of the Jekyll folder, for example, called src. Rename the directory where the site is created by default to htdocs, since this is the folder name used by Gandi. Hence, once jekyll serve has been run, the site has the following struture:

jekyll\
  htdocs\
    index.html
  src\
    index.md
  _config.yml

Change the _config.yml file to make sure it used these folders, by adding the following lines:

source: src
destination: htdocs

Make a repository and connect it up

Now, using the information on the Gandi git page, run the following commands in the Jekyll folder to make it a git repository:

git init
git add .
git commit -m "first version of jekyll site"

Associate the local repository with the Gandi repository:

git remote add origin ssh+git://{login}@git.{datacenter_location}.gpaas.net/{vhost}.git

Upload the site to the Gandi repository:

git push origin master

Now the files should be in the Gandi git repository of your vhost. The files can be seen by going to the Administration interface at an address like https://{login-number}.admin.{datacentre-id}.gpaas.net/gitweb/

One last step is required to make the files published on the web site. The following command checks the code out of the Gandi git repository and into the vhost folder, so will now be live.

ssh {login}@git.{datacenter_location}.gpaas.net 'deploy {vhost}.git master'

Make sure those temporary files do not get committed in the future

To ensure the same files are not committed in the future, edit the Jekyll folder’s .gitignore and added the line:

*~