This article describes how to set up a client on your computer to work with a Git repository stored on an A2 Hosting server.
After you create a repository on your A2 Hosting account, you probably want to be able to access it and work with it remotely instead of directly on the server. To do this, you use a Git client.
Follow the appropriate procedure below for the operating system installed on your computer.
There are many Git clients available for computers running Microsoft Windows. This article describes how to install and configure TortoiseGit, a popular Windows client for managing Git projects.
To use TortoiseGit, you must download and install the client, as well as Git for Windows. To do this, follow these steps:
The git command line client is often the quickest and easiest way to interact with a remote Git repository, although there are GUI-based clients as well. In either case, however, clients commonly use SSH to access Git. For security reasons, A2 Hosting uses custom port 7822 for SSH connections instead of the default port 22. Therefore, whichever Git client you use, you must configure it to use port 7822 for SSH.
For example, the following command demonstrates how to clone a repository stored on an A2 Hosting server. Replace both instances of username with your A2 Hosting account username, example.com with your domain name, and repository with the path to the repository:
git clone ssh:[email protected]:7822/home/username/repository
In the previous command, we explicitly specify port number 7822. However, you can also define the SSH port number for a remote host in your ~/.ssh/config file as follows:
Host example Hostname example.com Port 7822 User username
The Host value can be any name you want. The Hostname value is the remote host you want to access, the port number is 7822, and the User value specifies your A2 Hosting account username. With this configuration defined, you can run git commands for the example.com domain by simply using the Host value. You do not have to specify the port number and username each time. The following command demonstrates how to do this:
git clone ssh://example/home/username/repository