Let's say that I have a gerrit server set up such that it registers
users through LDAP accounts.
Unfortunately, my LDAP account is different from my own personal
computer username.
I can clone a manifest really easy with:
repo init -u ssh://<my_ldap_username>@<gerrit_server>:29418/manifest.git
However, once I have the manifest cloned, I'm going to experience a
problem on the repo sync.
Here's my basic manifest info:
<remote name="my_remote"
fetch="ssh://<gerrit_server>:29418" />
If I do a repo sync, I'll end up fetching using my personal computer
login name, which will fail due to key mismatches.
I can get around this by making myself a personal branch for the
manifest that has my LDAP username, i.e.:
<remote name="my_remote"
fetch="ssh://<my_ldap_username>@<gerrit_server>:29418" />
But, this isn't so nice, because I have to maintain a branch every
time the repo list changes.
I was thinking it would be nice to set things as so:
<remote name="my_remote"
fetch="ssh://$BASHALIAS@<gerrit_server>:29418" />
and then I can have users all define BASHALIAS in their .bashrc.
However, this doesn't seem to work-- I am guessing because the fetch
string is evaluated as a literal, and therefore the alias doesn't go
through.
Has anyone else had any way around this? Maybe there's some simple
git config that I'm not thinking of to force my username to always be
my LDAP username, instead of my PC's default username.
I'm aware of user.name and user.email, but is there another one that I
can use? user.name seems to be for my full name.
Any thoughts?
Regards,
-John
> Let's say that I have a gerrit server set up such that it registers
> users through LDAP accounts.
> Unfortunately, my LDAP account is different from my own personal
> computer username.
>
> I can clone a manifest really easy with:
> repo init -u ssh://<my_ldap_username>@<gerrit_server>:29418/manifest.git
>
> However, once I have the manifest cloned, I'm going to experience a
> problem on the repo sync.
>
> Here's my basic manifest info:
> <remote name="my_remote"
> fetch="ssh://<gerrit_server>:29418" />
>
> If I do a repo sync, I'll end up fetching using my personal computer
> login name, which will fail due to key mismatches.
Either use an insteadOf block in your ~/.gitconfig,
[url "ssh://username@hostname:29418/"]
insteadOf = ssh://hostname:29418/
or (preferably)
Host hostname
User username
Port 29418
in your ~/.ssh/config. The latter has the advantage that it works
not only when fetching code with git but in any circumstances when
you want to connect to Gerrit via SSH, i.e. you can say
git push ssh://hostname/path/to/git
or
ssh hostname gerrit ls-projects
instead of repeating the username and port information there too.
[...]
--
Magnus Bäck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson
-John