Error while using git review: Permission denied (publickey)

asked 2014-11-30 11:32:58 -0600

sagardmni gravatar image


I'm attempting to send code for review using 'git review', but I'm facing the following error.

root@envy:/home/sagar/gitstuff/horizon# git review
Problem running 'git remote update gerrit'
Fetching gerrit
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch gerrit
Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 11, in <module>
  File "/usr/local/lib/python2.7/dist-packages/git_review/", line 1202, in main
    set_hooks_commit_msg(remote, hook_file)
  File "/usr/local/lib/python2.7/dist-packages/git_review/", line 283, in set_hooks_commit_msg
    run_command_exc(CannotInstallHook, *cmd)
  File "/usr/local/lib/python2.7/dist-packages/git_review/", line 152, in run_command_exc
    raise klazz(rc, output, argv, env)
git_review.cmd.CannotInstallHook: Problems encountered installing commit-msg hook
The following command failed with exit code 1
    "scp -P29418 .git/hooks/commit-msg"
Permission denied (publickey).

Any ideas as to what the reason could be?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-12-13 23:40:50 -0600

dilip gravatar image

Looks like an ssh-agent is running already but it can not find any keys attached. To solve this add the private key identities to the authentication agent like so:


edit flag offensive delete link more

answered 2014-12-02 13:17:31 -0600

mpetason gravatar image

You are trying to auth with a Public key instead of your Private key? Do you have your public key uploaded so that you have a public/private combo?

edit flag offensive delete link more


Thanks for the reply. I followed the steps given to generate an ssh key at ( , and then I added the public key. That's all that is required as far as the ssh keys are concerned, right?

sagardmni gravatar imagesagardmni ( 2014-12-04 10:08:29 -0600 )edit

You will need to upload whatever is in "" and then you can use id_rsa as your private key. You need a public + private key pair. You auth with your Private key, which the public key is tied to.

mpetason gravatar imagempetason ( 2014-12-04 10:33:36 -0600 )edit

That's what I did. I have no idea why, but cloning the horizon repo again solved the issue. Thanks for your help anyway.

sagardmni gravatar imagesagardmni ( 2014-12-04 11:22:51 -0600 )edit

Weird. I'll clean up our comments and all in a minute. You should write an answer with what you did to resolve it, even though it doesn't really give a root cause.

mpetason gravatar imagempetason ( 2014-12-04 11:41:19 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-11-30 11:32:58 -0600

Seen: 2,826 times

Last updated: Dec 13 '16