threads / discuss / 48191

[OT] how does "git review --setup" figure out my username?

Subject: [OT] how does "git review --setup" figure out my username?

## tl;dr

4 messages between Mar 31, 2018 and Mar 31, 2018.

replies: 3people: 2as markdown or json

Robert P. J. Day· Mar 31, 2018, 19:04 UTC · lore
  (technically not a git question, but i kind of need to know the
answer to this quickly as i'm writing some documentation and this is
something i have to explain.)
  i cloned a repository (hyperledger fabric) which has a top-level
.gitreview file:
  [gerrit]
  host=gerrit.hyperledger.org
  port=29418
  project=fabric

and, as i read it, if i want to configure to use gerrit, an initial invocation of "git review --setup" should do that for me, which it appears to do, as it adds the following to .git/config:

  [remote "gerrit"]
        url = ssh://rpjday@gerrit.hyperledger.org:29418/fabric
        fetch = +refs/heads/*:refs/remotes/gerrit/*
and copies over the commit-msg hook. so far, so good.
  but from where does it figure out the username (rpjday) to use when
configuring that remote? i have no gerrit configuration in my
.gitconfig file. however, i have configured gerrit at the hyperledger
end to use my SSH key, which is associated with my linux foundation ID
(rpjday) that i registered to start using that repo.
  is that where it gets the username from?
rday
Ævar Arnfjörð Bjarmason· Mar 31, 2018, 19:37 UTC · re: Robert P. J. Day · lore

Re: [OT] how does "git review --setup" figure out my username?

On Sat, Mar 31, 2018 at 9:04 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
Show 30 quoted lines
>
>   (technically not a git question, but i kind of need to know the
> answer to this quickly as i'm writing some documentation and this is
> something i have to explain.)
>
>   i cloned a repository (hyperledger fabric) which has a top-level
> .gitreview file:
>
>   [gerrit]
>   host=gerrit.hyperledger.org
>   port=29418
>   project=fabric
>
> and, as i read it, if i want to configure to use gerrit, an initial
> invocation of "git review --setup" should do that for me, which it
> appears to do, as it adds the following to .git/config:
>
>   [remote "gerrit"]
>         url = ssh://rpjday@gerrit.hyperledger.org:29418/fabric
>         fetch = +refs/heads/*:refs/remotes/gerrit/*
>
> and copies over the commit-msg hook. so far, so good.
>
>   but from where does it figure out the username (rpjday) to use when
> configuring that remote? i have no gerrit configuration in my
> .gitconfig file. however, i have configured gerrit at the hyperledger
> end to use my SSH key, which is associated with my linux foundation ID
> (rpjday) that i registered to start using that repo.
>
>   is that where it gets the username from?

I've never used gerrit, but from my skimming of https://www.mediawiki.org/wiki/Gerrit/git-review#Setting_up_git-review and https://www.mediawiki.org/wiki/Gerrit/Tutorial#Configuring_git-review it seems (to me) to say that it simply tries if your local loginname works on the remote. Is rpjday your loginname on this system?

Robert P. J. Day· Mar 31, 2018, 19:56 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [OT] how does "git review --setup" figure out my username?

On Sat, 31 Mar 2018, Ævar Arnfjörð Bjarmason wrote:
Show 38 quoted lines
> On Sat, Mar 31, 2018 at 9:04 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> >
> >   (technically not a git question, but i kind of need to know the
> > answer to this quickly as i'm writing some documentation and this is
> > something i have to explain.)
> >
> >   i cloned a repository (hyperledger fabric) which has a top-level
> > .gitreview file:
> >
> >   [gerrit]
> >   host=gerrit.hyperledger.org
> >   port=29418
> >   project=fabric
> >
> > and, as i read it, if i want to configure to use gerrit, an initial
> > invocation of "git review --setup" should do that for me, which it
> > appears to do, as it adds the following to .git/config:
> >
> >   [remote "gerrit"]
> >         url = ssh://rpjday@gerrit.hyperledger.org:29418/fabric
> >         fetch = +refs/heads/*:refs/remotes/gerrit/*
> >
> > and copies over the commit-msg hook. so far, so good.
> >
> >   but from where does it figure out the username (rpjday) to use when
> > configuring that remote? i have no gerrit configuration in my
> > .gitconfig file. however, i have configured gerrit at the hyperledger
> > end to use my SSH key, which is associated with my linux foundation ID
> > (rpjday) that i registered to start using that repo.
> >
> >   is that where it gets the username from?
>
> I've never used gerrit, but from my skimming of
> https://www.mediawiki.org/wiki/Gerrit/git-review#Setting_up_git-review
> and
> https://www.mediawiki.org/wiki/Gerrit/Tutorial#Configuring_git-review
> it seems (to me) to say that it simply tries if your local loginname
> works on the remote. Is rpjday your loginname on this system?
  yes, but it's just a fluke that i used the same user name in both
places ... what if i hadn't? which one would it have selected?
rday
Ævar Arnfjörð Bjarmason· Mar 31, 2018, 20:10 UTC · re: Robert P. J. Day · lore

Re: [OT] how does "git review --setup" figure out my username?

On Sat, Mar 31 2018, Robert P. J. Day wrote:
Show 43 quoted lines
> On Sat, 31 Mar 2018, Ævar Arnfjörð Bjarmason wrote:
>
>> On Sat, Mar 31, 2018 at 9:04 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>> >
>> >   (technically not a git question, but i kind of need to know the
>> > answer to this quickly as i'm writing some documentation and this is
>> > something i have to explain.)
>> >
>> >   i cloned a repository (hyperledger fabric) which has a top-level
>> > .gitreview file:
>> >
>> >   [gerrit]
>> >   host=gerrit.hyperledger.org
>> >   port=29418
>> >   project=fabric
>> >
>> > and, as i read it, if i want to configure to use gerrit, an initial
>> > invocation of "git review --setup" should do that for me, which it
>> > appears to do, as it adds the following to .git/config:
>> >
>> >   [remote "gerrit"]
>> >         url = ssh://rpjday@gerrit.hyperledger.org:29418/fabric
>> >         fetch = +refs/heads/*:refs/remotes/gerrit/*
>> >
>> > and copies over the commit-msg hook. so far, so good.
>> >
>> >   but from where does it figure out the username (rpjday) to use when
>> > configuring that remote? i have no gerrit configuration in my
>> > .gitconfig file. however, i have configured gerrit at the hyperledger
>> > end to use my SSH key, which is associated with my linux foundation ID
>> > (rpjday) that i registered to start using that repo.
>> >
>> >   is that where it gets the username from?
>>
>> I've never used gerrit, but from my skimming of
>> https://www.mediawiki.org/wiki/Gerrit/git-review#Setting_up_git-review
>> and
>> https://www.mediawiki.org/wiki/Gerrit/Tutorial#Configuring_git-review
>> it seems (to me) to say that it simply tries if your local loginname
>> works on the remote. Is rpjday your loginname on this system?
>
>   yes, but it's just a fluke that i used the same user name in both
> places ... what if i hadn't? which one would it have selected?

Seems like a fairly common case, especially as gerrit tends to be used in Big Corp setups where your username is the same.

According to the docs I linked to it'll ask you if it doesn't happen to match, but as I've said never used it, and that may be wrong.

← back to recent threads