Home
/
SiteGround Git Tool Tutorial
/
Clone GitHub project to your SiteGround account

Clone GitHub project to your SiteGround 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:

Host github.com
  IdentityFile ~/.ssh/key_name.private

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:

ssh -T -p22 git@github.com

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:

Hi username! You've successfully authenticated, but GitHub does not provide shell access.

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

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

git clone git@github.com:username/repo.git

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

Share This Article