Skip to content

Working with Git

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.

Document roots

The default document root on Cito servers is public_html inside your home directory.

SSH keys

You may need to add additional SSH keys to a site in order to allow external systems to connect.

To do this, paste the public key into a new line in:

/home/<username>/.ssh/authorized_keys

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.

ssh-keygen -t ed25519

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:

git pull

Additional resources

There are a number of resources available online to help you learn Git. Here are some of our favourites: