Installing SSH Private Key On Remote Server for GIT

When using SSH URIs with GIT it in turn relies on accessing your own private SSH key to talk to the git server.

To make this work seamlessly without any additional commands things like "git clone" etc.

Create Directories

Log into the server using your own user id and cd into your home directory:

cd ~

Then create the ".ssh" directory:

mkdir -p ~/.ssh && chmod 700 ~/.ssh

Upload File

Now, using an SFTP, client on your desktop log into the server and upload your private key file from your local machine into the newly created .ssh directory.

After uploading the file, make sure it is named  "id_rsa" and inside the ".ssh/"  directory.

Adjust Permissions

Once the file is uploaded, go back in to your SSH command line session and adjust the permissions by running this command:

chmod 600 ~/.ssh/id_rsa

Run Your Git Commands

With this file in place you should now be able to run your GIT commands as long as that key's public string has been added to the GIT server.

For example this would create a new directory for your project then do a git clone of it from GIT Hub:

mkdir mynewproject

cd mynewproject

git clone git@github.com:yourcompany/yourrepo.git .