All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hong Xu <xuhdev@gmail.com>
To: "Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [BUG] git bash-completion is incorrect for "git pull origin mas<tab>" if the ssh key is encrypted
Date: Thu, 22 Mar 2012 21:00:52 +0800	[thread overview]
Message-ID: <4F6B2284.5030508@gmail.com> (raw)
In-Reply-To: <4F6B2146.8060408@in.waw.pl>

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

  reply	other threads:[~2012-03-22 13:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F6B2284.5030508@gmail.com \
    --to=xuhdev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=zbyszek@in.waw.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.