git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
@ 2012-03-22  6:04 Hong Xu
  2012-03-22 10:28 ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 11+ messages in thread
From: Hong Xu @ 2012-03-22  6:04 UTC (permalink / raw)
  To: git

Hello everyone,

If my ssh key is encrypted, "git pull origin mas<tab>" will give a 
unexpected result, something like this:

git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':

I know maybe it is not possible to complete the "master", but maybe it 
is better to not complete anything than append something like that?

Thanks!

Hong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22  6:04 [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted Hong Xu
@ 2012-03-22 10:28 ` Zbigniew Jędrzejewski-Szmek
  2012-03-22 12:10   ` Johannes Sixt
  2012-03-22 17:46   ` Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-03-22 10:28 UTC (permalink / raw)
  To: Hong Xu; +Cc: git

On 03/22/2012 07:04 AM, Hong Xu wrote:
> Hello everyone,
>
> If my ssh key is encrypted, "git pull origin mas<tab>" will give a
> unexpected result, something like this:
>
> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
>
> I know maybe it is not possible to complete the "master", but maybe it
> is better to not complete anything than append something like that?
It is ssh itself which emits this message. The completion script calls 
'git ls-remote origin', which in turn invokes ssh. Typing the password 
in actually works, but I understand that you are annoyed by the message.

I don't think there's an easy way to silence this in git completion, 
without affecting other times when the key would be requested. E.g. we 
would want ssh to ask for the key while doing 'git pull', but not when 
run automatically during completion.

Maybe git-ls-remote should learn --quiet?

Zbyszek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 10:28 ` Zbigniew Jędrzejewski-Szmek
@ 2012-03-22 12:10   ` Johannes Sixt
  2012-03-22 12:48     ` Hong Xu
  2012-03-22 17:46   ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: Johannes Sixt @ 2012-03-22 12:10 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: Hong Xu, git

Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:
> On 03/22/2012 07:04 AM, Hong Xu wrote:
>> Hello everyone,
>>
>> If my ssh key is encrypted, "git pull origin mas<tab>" will give a
>> unexpected result, something like this:
>>
>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
>>
>> I know maybe it is not possible to complete the "master", but maybe it
>> is better to not complete anything than append something like that?
> It is ssh itself which emits this message. The completion script calls
> 'git ls-remote origin', which in turn invokes ssh. Typing the password in
> actually works, but I understand that you are annoyed by the message.
> 
> I don't think there's an easy way to silence this in git completion,
> without affecting other times when the key would be requested. E.g. we
> would want ssh to ask for the key while doing 'git pull', but not when run
> automatically during completion.
> 
> Maybe git-ls-remote should learn --quiet?

No. IMHO, bash completion stretches too far by asking the remote for the
refs that it has.

-- Hannes

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 12:10   ` Johannes Sixt
@ 2012-03-22 12:48     ` Hong Xu
  2012-03-22 12:55       ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 11+ messages in thread
From: Hong Xu @ 2012-03-22 12:48 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Zbigniew Jędrzejewski-Szmek, git



On Mar 22, 2012, at 20:10, Johannes Sixt <j.sixt@viscovery.net> wrote:

> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:
>> On 03/22/2012 07:04 AM, Hong Xu wrote:
>>> Hello everyone,
>>> 
>>> If my ssh key is encrypted, "git pull origin mas<tab>" will give a
>>> unexpected result, something like this:
>>> 
>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
>>> 
>>> I know maybe it is not possible to complete the "master", but maybe it
>>> is better to not complete anything than append something like that?
>> It is ssh itself which emits this message. The completion script calls
>> 'git ls-remote origin', which in turn invokes ssh. Typing the password in
>> actually works, but I understand that you are annoyed by the message.
>> 
>> I don't think there's an easy way to silence this in git completion,
>> without affecting other times when the key would be requested. E.g. we
>> would want ssh to ask for the key while doing 'git pull', but not when run
>> automatically during completion.
>> 
>> Maybe git-ls-remote should learn --quiet?
> 
> No. IMHO, bash completion stretches too far by asking the remote for the
> refs that it has.
> 

I agree with this rather than using silent mode. If a encrypted key is found, I think we better drop the completion. I don't know whether there is a way to implement this yet, at least we can try to find it.

Hong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 12:48     ` Hong Xu
@ 2012-03-22 12:55       ` Zbigniew Jędrzejewski-Szmek
  2012-03-22 13:00         ` Hong Xu
  0 siblings, 1 reply; 11+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-03-22 12:55 UTC (permalink / raw)
  To: Hong Xu; +Cc: Johannes Sixt, git

On 03/22/2012 01:48 PM, Hong Xu wrote:
>
>
> On Mar 22, 2012, at 20:10, Johannes Sixt<j.sixt@viscovery.net>  wrote:
>
>> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:
>>> On 03/22/2012 07:04 AM, Hong Xu wrote:
>>>> Hello everyone,
>>>>
>>>> If my ssh key is encrypted, "git pull origin mas<tab>" will give a
>>>> unexpected result, something like this:
>>>>
>>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
>>>>
>>>> I know maybe it is not possible to complete the "master", but maybe it
>>>> is better to not complete anything than append something like that?
>>> It is ssh itself which emits this message. The completion script calls
>>> 'git ls-remote origin', which in turn invokes ssh. Typing the password in
>>> actually works, but I understand that you are annoyed by the message.
>>>
>>> I don't think there's an easy way to silence this in git completion,
>>> without affecting other times when the key would be requested. E.g. we
>>> would want ssh to ask for the key while doing 'git pull', but not when run
>>> automatically during completion.
>>>
>>> Maybe git-ls-remote should learn --quiet?
>>
>> No. IMHO, bash completion stretches too far by asking the remote for the
>> refs that it has.
>>
>
> I agree with this rather than using silent mode. If a encrypted key is found, I think we better drop the completion. I don't know whether there is a way to implement this yet, at least we can try to find it.
There's more than one reason why ssh would ask for a password. So just
checking for an encrypted key is pointless. Instead, ssh could be 
invoked with -o BatchMode=yes. ls-remote could pass this option if it 
was invoked with --quiet.

Possible this is just not worth the trouble and Hong should enter the 
run ssh-agent and enter the password beforehand.

Zbyszek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 12:55       ` Zbigniew Jędrzejewski-Szmek
@ 2012-03-22 13:00         ` Hong Xu
  0 siblings, 0 replies; 11+ messages in thread
From: Hong Xu @ 2012-03-22 13:00 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: Johannes Sixt, git

On 03/22/2012 08:55 PM, Zbigniew Jędrzejewski-Szmek wrote:
> On 03/22/2012 01:48 PM, Hong Xu wrote:
>>
>>
>> On Mar 22, 2012, at 20:10, Johannes Sixt<j.sixt@viscovery.net> wrote:
>>
>>> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:
>>>> On 03/22/2012 07:04 AM, Hong Xu wrote:
>>>>> Hello everyone,
>>>>>
>>>>> If my ssh key is encrypted, "git pull origin mas<tab>" will give a
>>>>> unexpected result, something like this:
>>>>>
>>>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
>>>>>
>>>>> I know maybe it is not possible to complete the "master", but maybe it
>>>>> is better to not complete anything than append something like that?
>>>> It is ssh itself which emits this message. The completion script calls
>>>> 'git ls-remote origin', which in turn invokes ssh. Typing the
>>>> password in
>>>> actually works, but I understand that you are annoyed by the message.
>>>>
>>>> I don't think there's an easy way to silence this in git completion,
>>>> without affecting other times when the key would be requested. E.g. we
>>>> would want ssh to ask for the key while doing 'git pull', but not
>>>> when run
>>>> automatically during completion.
>>>>
>>>> Maybe git-ls-remote should learn --quiet?
>>>
>>> No. IMHO, bash completion stretches too far by asking the remote for the
>>> refs that it has.
>>>
>>
>> I agree with this rather than using silent mode. If a encrypted key is
>> found, I think we better drop the completion. I don't know whether
>> there is a way to implement this yet, at least we can try to find it.
> There's more than one reason why ssh would ask for a password. So just
> checking for an encrypted key is pointless. Instead, ssh could be
> invoked with -o BatchMode=yes. ls-remote could pass this option if it
> was invoked with --quiet.

This is a good idea.

>
> Possible this is just not worth the trouble and Hong should enter the
> run ssh-agent and enter the password beforehand.

If I entered the password, it would be like this:

git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':
ter

Then I press Enter, the command runs as it should be. The only problem 
is that this is a bit annoying.

Hong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 10:28 ` Zbigniew Jędrzejewski-Szmek
  2012-03-22 12:10   ` Johannes Sixt
@ 2012-03-22 17:46   ` Junio C Hamano
  2012-03-22 17:55     ` Matthieu Moy
  2012-03-22 17:56     ` Hong Xu
  1 sibling, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2012-03-22 17:46 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: Hong Xu, git

Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:

> Maybe git-ls-remote should learn --quiet?

I would rather think that the completion should ask for refs only when
dealing with local repositories, without going over network, whether the
query involves authentication or not.

When given a repository nickname, do we have a good way for the completion
script to tell if it is local or remote?  "type -d $it" might be cheap way
to do so, or we could even do "test $it = ." to limit it really to the
current repository.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 17:46   ` Junio C Hamano
@ 2012-03-22 17:55     ` Matthieu Moy
  2012-03-22 18:30       ` Zbigniew Jędrzejewski-Szmek
  2012-03-22 18:45       ` Junio C Hamano
  2012-03-22 17:56     ` Hong Xu
  1 sibling, 2 replies; 11+ messages in thread
From: Matthieu Moy @ 2012-03-22 17:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Zbigniew Jędrzejewski-Szmek, Hong Xu, git

Junio C Hamano <gitster@pobox.com> writes:

> Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:
>
>> Maybe git-ls-remote should learn --quiet?
>
> I would rather think that the completion should ask for refs only when
> dealing with local repositories, without going over network, whether the
> query involves authentication or not.

It depends on what "network" is. When the network is just a machine on
the same Gb-ethernet LAN, completion can still be useful (only if you
have password-less authentication of course). I don't use it much with
Git, but I find it handy that ZSH completes rsync remote pathes for
example.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 17:46   ` Junio C Hamano
  2012-03-22 17:55     ` Matthieu Moy
@ 2012-03-22 17:56     ` Hong Xu
  1 sibling, 0 replies; 11+ messages in thread
From: Hong Xu @ 2012-03-22 17:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Zbigniew Jędrzejewski-Szmek, git



On Mar 23, 2012, at 1:46, Junio C Hamano <gitster@pobox.com> wrote:

> Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:
> 
>> Maybe git-ls-remote should learn --quiet?
> 
> I would rather think that the completion should ask for refs only when
> dealing with local repositories, without going over network, whether the
> query involves authentication or not.
> 

Could you give some reasons about why shouldn't we go through network?

Hong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 17:55     ` Matthieu Moy
@ 2012-03-22 18:30       ` Zbigniew Jędrzejewski-Szmek
  2012-03-22 18:45       ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-03-22 18:30 UTC (permalink / raw)
  To: Matthieu Moy, Junio C Hamano; +Cc: Hong Xu, git

On 03/22/2012 06:55 PM, Matthieu Moy wrote:
> Junio C Hamano<gitster@pobox.com>  writes:
>
>> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:
>>
>>> Maybe git-ls-remote should learn --quiet?
>>
>> I would rather think that the completion should ask for refs only when
>> dealing with local repositories, without going over network, whether the
>> query involves authentication or not.
>
> It depends on what "network" is. When the network is just a machine on
> the same Gb-ethernet LAN, completion can still be useful (only if you
> have password-less authentication of course). I don't use it much with
> Git, but I find it handy that ZSH completes rsync remote pathes for
> example.
Yeah, I can second that. Even on a slow network, it can be useful. I use 
ssh with ControlMaster=yes and completion over a relatively slow network 
is pretty much instantaneous.

-
Zbyszek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
  2012-03-22 17:55     ` Matthieu Moy
  2012-03-22 18:30       ` Zbigniew Jędrzejewski-Szmek
@ 2012-03-22 18:45       ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2012-03-22 18:45 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Zbigniew Jędrzejewski-Szmek, Hong Xu, git

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

>> I would rather think that the completion should ask for refs only when
>> dealing with local repositories, without going over network, whether the
>> query involves authentication or not.
>
> It depends on what "network" is. When the network is just a machine on
> the same Gb-ethernet LAN, completion can still be useful (only if you
> have password-less authentication of course). I don't use it much with
> Git, but I find it handy that ZSH completes rsync remote pathes for
> example.

Yeah, I agree it depends on your latency-tolerance (which implies that
this begs for an "I am impatient, do not go over network" switch).

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-03-22 18:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22  6:04 [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted Hong Xu
2012-03-22 10:28 ` Zbigniew Jędrzejewski-Szmek
2012-03-22 12:10   ` Johannes Sixt
2012-03-22 12:48     ` Hong Xu
2012-03-22 12:55       ` Zbigniew Jędrzejewski-Szmek
2012-03-22 13:00         ` Hong Xu
2012-03-22 17:46   ` Junio C Hamano
2012-03-22 17:55     ` Matthieu Moy
2012-03-22 18:30       ` Zbigniew Jędrzejewski-Szmek
2012-03-22 18:45       ` Junio C Hamano
2012-03-22 17:56     ` Hong Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).