SSH and GIT

Sometimes when you try to push code to a remote git repository, you may come across this error:

Permission denied (publickey).
fatal: Could not read from remote repository.


Please make sure you have the correct access rights

Here are a few things to check on a mac.

Start the ssh-agent with this:

eval `ssh-agent` 

Run

ssh-add -l

This will list any keys already added to the ssh-agent. If no keys are presently added, 

The agent has no identities.

will be shown.

Add your key by running:

ssh-add -K ~/.ssh/your_private_key

Leave a Reply

Your email address will not be published. Required fields are marked *