How to connect to a remote GIT from Windows PC

  1. Download and Install GIT Tool from below URL:
  2. While installing the tool keep all the default settings
  3. Create a folder named as projects for your site/application (maybe in your Documents folder)
  4. Open GIT GUI tool and generate a key from the Help menu
  5. The keys get created in your Users/USERNAME/.ssh folder
  6. Import both (public and private) keys to your server using CPanel
  7. Open GIT command line tool and navigate to the Documents folder (i.e. one folder above projects)
  8. Run the command: git clone ssh://USERNAME@IP_ADDRESS/home/USER/repositories/REPO_NAME


Now just make some changes to your code and commit the change using

git commit

The changes can be pushed to the remote server using below command

git push origin master

Set remote GIT on VPS / Dedicated server

It is possible to set Remote GIT on your own server provided your hosting provider allows to install GIT on the server.

If your site/application is hosted on VPS or a dedicated server then it much easier to do so.

Prerequisite to set remote GIT

GIT should be installed on there server

If you are on VPS or dedicated server then it is likely that GIT is already installed on the server.

To check if GIT is installed or not SSH to your server and try below command.

If GIT is installed then it will show the version of GIT.

If not it will give an error message.

If GIT is not installed then you first need to install GIT on your server. For this you may need root access to your server. If you do not have root access ask your hosting provider to install GIT for you.

Once git is installed follow below steps on the server to set remote GIT

Create a Directory

SSH to your server (using Putty on Windows or using terminal on MAC)

Initialise Repository

Hook (Push to deploy)

post-receive hook in GIT is used to perform action after receiving or committing a file to GIT. This hook can be used to deploy our changes automatically to the live server using below commands.

Add below content to the post-receive hook/file

Press ctrl+d to save the file

File permissions

Through these simple steps your GIT is ready to accept commits. On the client side or on the localhost you can set up Remote GIT to push your changes to the server. This is easily possible if you are using Netbeans or similar software.