Clone GitHub project to your SiteGround account

Learn how to clone a GitHub repository to your SiteGround hosting account

The Git setup on our servers allows you to clone your existing GitHub repositories to your SiteGround hosting account. This tutorial explains how to use your existing GitHub SSH keys to clone your projects on your SiteGround account.

Once you have generated an SSH key pair on your SiteGround account, you need to obtain the public key. The public key can be found in the ~/.ssh/authorized_keys2 file on your account. Copy the entire public key and add it to your GitHub account.

Once you have added the public key, you must configure the SSH service on your SiteGround account to use its corresponding private key when connecting to GitHub. This can be done by editing the file at ~/.ssh/config. If the file does not exist, create a new one. Inside the file, add the following lines:

Make sure to replace key_name.private with the exact name of your private key.

Now you can test the connection between your hosting account and GitHub with the following command:

Important!The SSH command is not available by default on our Cloud and Dedicated server hosting plans. Outgoing connections on port 22 towards GitHub are also not allowed by default. To have the SSH command installed and the outgoing connection allowed, you should contact our support team by posting a new ticket from your User Area -> Support tab -> Request Assistance From Our Team.

You may see a prompt for the SSH key passphrase if you have used such when generating the key pair.

If you have done everything correctly, you should see the following response from the above command:

where username will be your GitHub username. This means that the connection and the authentication was successful.

Now, to clone your GitHub repository to your SiteGround account you can use the following command:

You should replace username and repo with your GitHub username and repository name respectively.