Clone GitHub Project to your SiteGround Account
How to use SSH keys and SSH Agent Forwarding to clone your GitHub projects to your SiteGround account
The Git setup on our servers allows you to clone your existing GitHub repositories to your SiteGround hosting account. One of the most popular methods to establish a secure connection between your computer and GitHub is to use SSH keys. This tutorial explains how to use your existing GitHub SSH keys to clone your projects on your SiteGround account. If you are not using SSH keys to connect to your GitHub repositories you can read this tutorial on how to generate SSH keys for more information on that matter.
Once you’ve configured your GitHub account to use your SSH keys you can test the connection between your local computer and GitHub servers. To do this just execute the following command on your local computer:
ssh -T -p22 firstname.lastname@example.org
You may see this warning message:
The authenticity of host 'github.com (18.104.22.168)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
This is absolutely normal and you should type “yes” to continue. If the SSH keys are properly added on your end you will see the following reply from GitHub servers:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
If you see your own GitHub username then you’ve successfully set up your SSH key on your local computer. The next step is to configure SSH Agent Forwarding on your computer, so that you can use your existing SSH keys on your SiteGround account. SSH Agent Forwarding is a technique which allows remote servers to access your local ssh-agent as if it was running on the remote machines. To allow remote servers to access your local SSH keys you need to edit the .ssh/config file on your computer. Add the following lines to the config file:
Don’t forget to replace example.com with the name of the SiteGround server which hosts your account. For example, if your site is hosted on siteground224.com then you have to add the following lines to the config file:
Next, you have to connect to your SiteGround account via SSH. Once you access your account try to connect to the GitHub servers again by executing the command which we mentioned earlier:
ssh -T -p22 email@example.com
If you see your GitHub username this means that the local SSH keys have been successfully used on your SiteGround server to connect to your GitHub account. The last step is to simply clone the GitHub repository.
git clone firstname.lastname@example.org:username/repo.git
Of course, you need to change your GitHub username and the name of the repository which you want to clone to your SiteGround account.