repo sync permission denied

6,283 views
Skip to first unread message

Eric Tsai

unread,
May 11, 2009, 11:19:25 AM5/11/09
to Repo and Gerrit Discussion
If I use my own account, repo and gerrit work fine.
But many other people told me that they get error message during repo
sync:

$ ~/repo sync
Fetching projects: 100% (2/2)
Initializing project git_test ...
Permission denied (publickey).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: Cannot fetch git_test
$ ~/repo sync
Fetching projects: 100% (2/2) Permission denied (publickey).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: Cannot fetch git_test

There are no error message in Jetty stderrout.log.
I'm sure that users' public keys are already in account_ssh_keys table
and
all Registered Users(instead of default Anonymous Users) have Read
Access to -- All Projects --.
What may be the problem?

Shawn Pearce

unread,
May 11, 2009, 11:25:26 AM5/11/09
to repo-d...@googlegroups.com
On Mon, May 11, 2009 at 08:19, Eric Tsai <erict...@gmail.com> wrote:

If I use my own account, repo and gerrit work fine.
But many other people told me that they get error message during repo
sync:

$ ~/repo sync
Fetching projects: 100% (2/2)
Initializing project git_test ...
Permission denied (publickey).
Permission denied (publickey).

Two things come to mind:

- User has the wrong user name, e.g. they are trying to authenticate as their local username, but their SSH User Name in Gerrit is different.

- User didn't load their public keys into their ssh-agent.

I've seen that happen fairly often.  Especially the latter, where the user reboots their system after a week and forgets they need to reload their SSH keys into their ssh-agent process after the reboot.

Have the user double check they can login with just plain SSH, e.g.:

  $ ssh -p 29418 your.gerrit.server
  gerrit: no shell available
  Connection to your.gerrit.server closed.

Check the URL Gerrit is using with "repo --trace sync", make sure its something sane, like "ssh://your.gerrit.server:29418/git_test.git".

Eric Tsai

unread,
May 11, 2009, 1:57:13 PM5/11/09
to Repo and Gerrit Discussion
I found the problem by repo --trace sync

In my manifest.git/default.xml, I want users to download proejcts from
gerrit (to take advantage of the access control).
So I write my SSH_Username in it. Then repo tries to download as me.

<remote name="origin"
fetch="ssh://erictsai@gerrit:29418"
review="gerrit" />

Is there a way to achieve my goal (such as dynamically replace
erictsai with each user's SSH username)?

On 5月11日, 下午11時25分, Shawn Pearce <s...@google.com> wrote:

Brad Larson

unread,
May 11, 2009, 2:07:11 PM5/11/09
to Repo and Gerrit Discussion
Currently we have users create an entry in .ssh/config that lists
their username for connecting to Gerrit.

Shawn, please let us know if there is a better way!

Mike Lockwood

unread,
May 11, 2009, 2:08:00 PM5/11/09
to repo-d...@googlegroups.com
You should be able to do this by adding an entry to your ~/.ssh/config
file instead of changing the manifest. Something like:

Host gerrit
Port 29418
User erictsai53

Mike

2009/5/11 Eric Tsai <erict...@gmail.com>:
--
Mike Lockwood
Google android team

Shawn Pearce

unread,
May 11, 2009, 2:11:52 PM5/11/09
to repo-d...@googlegroups.com
2009/5/11 Mike Lockwood <lock...@android.com>


You should be able to do this by adding an entry to your ~/.ssh/config
file instead of changing the manifest.  Something like:

Host gerrit
   Port 29418
   User erictsai53

Yup.  And don't put a username in the URL in the manifest.  You can put the port if you want, so users don't have to list it in the ~/.ssh/config file.

Eric Tsai

unread,
May 11, 2009, 2:18:39 PM5/11/09
to Repo and Gerrit Discussion
Thank you guys!

On 5月12日, 上午2時11分, Shawn Pearce <s...@google.com> wrote:
> 2009/5/11 Mike Lockwood <lockw...@android.com>
Reply all
Reply to author
Forward
0 new messages