Git and SSH Debugging

by Chris Boyce on Jan 2014

This guide covers some common troubleshooting methods when connecting to Git

SSH Permissions

On your local machine, make sure your permissions are correct on you SSH keys. The default keys will be named id_rsa and id_rsa.pub.

chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub

In addition, ensure that the known_hosts and .ssh directory both have the correct permissions set.

chmod 644 ~/.ssh/known_hosts
chmod 755 ~/.ssh

SSH Agent

The SSH agent provides a way to store one or more SSH keys during your session. This allows you to connect to other hosts without explicitly specifying which key to use each time. To ensure that your SSH agent is working and has the correct keys, use the following commands:

ssh-add -D
exec ssh-agent bash
ssh-add ~/.ssh/id_rsa

Your should be prompted to enter your passphrase, and receive an "Identity added" confirmation message.

Trying It Out

You can run the following command to verify that you can connect to Git through SSH:

ssh git@www.cs.usfca.edu info

If successful, you should see output similar to this:

$ ssh git@www.cs.usfca.edu info
hello cdboyce, this is git@www running gitolite3 v3.5.1-8-gd8fa068 on git 1.7.1

 R W    cdboyce

Getting More Help

If you have questions, or if you continue to have difficulties, please contact support@cs.usfca.edu