"Could not connect to gerrit." on first startup / Use existing remotes to determine gerrit location

Bug #1097278 reported by Marcin Cieślak on 2013-01-08
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
git-review
New
Undecided
Unassigned

Bug Description

When starting git-review for a first time after cloning the repository:

```
Script started on Tue Jan 8 14:36:34 2013
$ git clone ssh://saperski@revi
$ openstack.org:29418/openstack-inf>
Cloning into gr...
remote: Counting objects: 684, done
remote: Finding sources: 100% (684/684)
remote: Total 684 (delta 310), reused 571 (delta 310)
Receiving objects: 100% (684/684), 452.76 KiB, done.
Resolving deltas: 100% (310/310), done.
$ cd gr
$ git remote -v
origin ssh://<email address hidden>:29418/openstack-infra/git-review.git (fetch)
origin ssh://<email address hidden>:29418/openstack-infra/git-review.git (push)
$ git-review -s
Could not connect to gerrit.
Enter your gerrit username:
Trying again with ssh://@review.openstack.org:29418/openstack-infra/git-review.git
<traceback object at 0x86e7a0>
We don't know where your gerrit is. Please manually create
a remote named "gerrit" and try again.
Traceback (most recent call last):
  File "/usr/home/saper/gerrit/openstack-git-review/git-review", line 929, in <module>
(...)
```

This is because git-review overly relies on .gitreview file to determine
how to access gerrit. In particular, .gitreview does not contain username
and the user needs to provide it, even it has a successful SSH clone.

I would propose to reverse the logic:

1) check the existing remotes first
2) try to deduce repository parameters
3) ask for username if (2) succeds
4) fall back to .gitreview

Ideally, if we could determine the desired remote branch, .gitreview file would
be not needed at all.

I will be working on this if there is a rough consensus on this way to proceed.

Mukul Jain (mukul-j) wrote :

were you able to find solution ? I am running into similar issue not sure if it is the same though. I just followed the instructions here : http://docs.openstack.org/training-guides/content/developer-getting-started-lab.html

and now I am getting similar error as you mentioned when I try

"git review -s" command. it says:
Could not connect to gerrit.
Enter your gerrit username:

when I enter my launchpad userid or email address that is used to login it gives error:
We don't know where your gerrit is. Please manually create a remote
named "gerrit" and try again.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/git-review", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/git_review/cmd.py", line 1173, in main
    config['hostname'], config['port'], config['project'])
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/git_review/cmd.py", line 593, in check_remote
    add_remote(scheme, hostname, port, project, remote)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/git_review/cmd.py", line 333, in add_remote
    raise Exception("Could not connect to gerrit at %s" % remote_url)
Exception: Could not connect to gerrit at ssh://<email address hidden>@review.openstack.org:29418/openstack/openstack-manuals.git
MUJAIN-M-V03C:opensta

Mukul Jain (mukul-j) wrote :

I was able to find the root cause/issue for this. I had not created the Gerrit username and password since the login to Gerrit site worked with my launchpad userid pwd. After I went to settings and created a username and pwd I was able to successfully use "git review -s" command.

thx

sunjiyun (sunjiyun) wrote :

I tried to make an open source community code submission contact, sign up for various accounts, then

git clone https://github.com/stackforge/stackalytics.git

cd stackalytics

git remote –v

git remote update

git checkout master

git pull --ff-only origin master

git checkout -b update_user_info

then

edit etc/default_data.json

git add etc/default_data.json

git commit -m "add my information to default_data.json

git review

Problem running 'git remote update gerrit'
Fetching gerrit
warning: redirecting to https://review.opendev.org/openstack/stackalytics.git/
fatal: remote error: Git repository not found
error: Could not fetch gerrit
Problem running 'git remote update gerrit'
Fetching gerrit
warning: redirecting to https://review.opendev.org/openstack/stackalytics.git/
fatal: remote error: Git repository not found
error: Could not fetch gerrit

git remote add gerrit https://myname:<email address hidden>/openstack/stackalytics.git

git git review -s

Exception :

Problem running 'git remote update gerrit'
Fetching gerrit
warning: redirecting to https://review.opendev.org/openstack/stackalytics.git/
fatal: remote error: Git repository not found
error: Could not fetch gerrit

why? is there anyone help

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers