You can connect sites to Git repositories, allowing you to deploy changes to your sites automatically. In Cito we map repositories 1:1 with sites in the dashboard.
You can connect a repository to your site at the Create Site wizard, or, for existing sites, from the Site Settings page.
You’ll be prompted to authorise Cito to connect to your github account or organisation. From there, you can select the repository to connect, as well as the branch. By default, we clone repositories to the Document root of your site. This applies even if you use a custom docroot.
Once connected you’ll be able to view recent commits and click ‘Deploy latest’ to pull your changes automatically.
CLI usage
Git is pre-installed by default to allow you to interact with repositories at Github, Bitbucket or other platforms. To do this you’ll need to log in via SSH.
If you are using a CI system to deploy files to your website, you should ensure the credentials you use are that of the site, not the admin user.
This ensures permissions are correct.
Note that cloning a repository via SSH will mean it doesn’t show up in the site settings page. We recommend connecting your repositories via the Cito dashboard first.
Document roots
The default document root on Cito servers is public_html inside your home directory. This can be changed via Site Settings if you need to.
SSH keys
You may need to add additional SSH keys to a site in order to allow external systems to connect.
To do this, see SSH.
Generating a new SSH keypair
If you wish to generate a new SSH key pair, you can do so by running the following SSH command. This is useful if you are working with private repositories and need to authenticate with Github or Bitbucket to clone them to your server.
Be sure to do this as the site user you’re working with; if you generate a keypair as admin you’ll need to then copy the keys to the relevant user.
You’ll be prompted for a key passphrase & location. It is safe to accept the defaults.
Once you’ve done this, you can add the public key to your Github account.
Cloning a repository
To clone a git repository, navigate to your chosen repository and run:
git clone https://<repo url> .
Pulling the latest version of a repository
To pull your latest changes, run:
Additional resources
There are a number of resources available online to help you learn Git. Here are some of our favourites: