Unable to clone Gerrit Repository

2,157 views
Skip to first unread message

Hassnain Alvi

unread,
Mar 15, 2015, 5:36:59 AM3/15/15
to repo-d...@googlegroups.com
I am trying to connect to gerrit hosted on my VPS. I am using Git Bash for windows. I have already added keys on gerrit server and i have added my public key to authorized_keys as well
when i run `ssh -p 29418 <username>@<gerrit-server>` i will see below welcome message

      ****    Welcome to Gerrit Code Review    ****
   
      Hi Full Name, you have successfully connected over SSH.
   
      Unfortunately, interactive shells are disabled.
      To clone a hosted Git repository, use:
   
      git clone ssh://username@<gerrit-server>:29418/REPOSITORY_NAME.git


but when i clone the repository by running following command

    git clone ssh://<username>@<gerrit-server>:29418/project-name.git

i see the following error in my Git Bash terminal

    Cloning into 'project-name'...
    ssh_exchange_identification: Connection closed by remote host
    fatal: Could not read from remote repository.
   
    Please make sure you have the correct access rights
    and the repository exists.


I am not able to understand what's going on and how to successfully clone my projects in my machine. Can anyone please help me in this matter?

Marcelo Ávila

unread,
Mar 15, 2015, 9:45:03 AM3/15/15
to Hassnain Alvi, Repo and Gerrit Discussion

Check the following:

(a) Do you have permition (in Gerrit) to clone (read) the repository?

(b) Are you using the FULL repository pathname (foo/boo/repo.git) in the clone command?

--
Marcelo Ávila de Oliveira
mav...@cpqd.com.br

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcelo Ávila

unread,
Mar 16, 2015, 9:32:36 AM3/16/15
to Hassnain Alvi, Repo and Gerrit Discussion
1) You need to have "Read" access to the project you want to clone (be an admin is not enough). See here.

2) This is needed only if you use directories to organize your repositories tree. See a example (plugins/avatars/gravatar repository) here.

--
Marcelo Ávila de Oliveira

2015-03-16 9:57 GMT-03:00 Hassnain Alvi <alvirock...@gmail.com>:
1) i am running gerrit on port 80 and i am a super admin of gerrit. I have included the SSH keys as well
2) i didn't understand the ful, path thing i ahve created a project in Gerrit what should be the path to clone its repo?

Hassnain Alvi

unread,
Mar 16, 2015, 12:46:00 PM3/16/15
to repo-d...@googlegroups.com, alvirock...@gmail.com
Can you please tell me how can i change read states of the project from UI. Will the new created project is not readable by default?

Hassnain Alvi

unread,
Mar 16, 2015, 12:52:01 PM3/16/15
to repo-d...@googlegroups.com, alvirock...@gmail.com
The project settings in the link you gave match the settings i have in my project. but i am not using the plugin 

Marcelo Ávila

unread,
Mar 16, 2015, 1:16:38 PM3/16/15
to Hassnain Alvi, Repo and Gerrit Discussion
Projects > List > project_name > Access > Edit

--
Marcelo Ávila de Oliveira

Marcelo Ávila

unread,
Mar 17, 2015, 2:35:03 PM3/17/15
to Hassnain Alvi, Repo and Gerrit Discussion
You need to add "Read" permission for Administrators to "refs/*" instead of "refs/heads/*"

--
Marcelo Ávila de Oliveira

2015-03-17 3:04 GMT-03:00 Hassnain Alvi <alvirock...@gmail.com>:
I have edited the access you can check the access.jpg file, i am attaching with this email. I am still getting the same error. Please check error.jpg for detailed error

I have also run following command ssh -p 29418 username@server-ip gerrit ls-projects | grep -i project-i-am-cloning

and it works fine return me the project name but still on cloning error is same. Please check the images

Hassnain Alvi

unread,
Mar 18, 2015, 3:40:49 PM3/18/15
to Marcelo Ávila, Repo and Gerrit Discussion
Tried it and nothing worked. Attaching the screenshots again with ssh settings
Please take a look at it and let me know the problem
Thanks


Gerrit Access.PNG
ssh-screenshot.PNG

Marcelo Ávila

unread,
Mar 18, 2015, 4:17:40 PM3/18/15
to Hassnain Alvi, Repo and Gerrit Discussion
Uhm... maybe you have some issue with your ssh (29418 port) access...

--
Marcelo Ávila de Oliveira

Hassnain Alvi

unread,
Mar 23, 2015, 10:00:31 AM3/23/15
to Marcelo Ávila, Repo and Gerrit Discussion
I am still not able to figure out what the problem is but i just want to share some weird thing which is happening right now. I created another SSH key and this time i added a passphrase for the SSH key. I added that key on the SSH server as well. Normally when there is a passphrase attached to the key the Git Bash terminal should asks for the passphrase to unlock the private key.
Now what's happening right now is if i ssh gerrit server by running command
ssh -p 29418 <username>@<gerrit-server>
it asks me to unlock passphrase that means its using the correct ssh key and it displays the Gerrit welcome message
The problem is that it don't ask for the passphrase when i run the git clone command listed above, that means that its using some other SSH key that's why i get SSH_exchange_identification error from Gerrit. Is there any other step i need to perform before cloning? Do i have to do any Git Setting to successfully clone Git Repository?

Marcelo Ávila

unread,
Mar 23, 2015, 1:11:28 PM3/23/15
to Hassnain Alvi, Repo and Gerrit Discussion
Do you have anything in the ~/.ssh/config file that could be messing the things up?

--
Marcelo Ávila de Oliveira

Reply all
Reply to author
Forward
0 new messages