Re: Ssh password on windows

1,257 views
Skip to first unread message

David Aguilar

unread,
Aug 22, 2012, 8:59:52 PM8/22/12
to Jesus Eguiluz, git-...@googlegroups.com
On Wed, Aug 22, 2012 at 5:34 AM, Jesus Eguiluz <jegu...@andeselec.com> wrote:
> I try to fetch from a git repo over ssh but the git cola not show a window
> to put the ssh password.
>
> However when run git-cola from console the ssh password is prompted by the
> console, then the fetch is succesfully.
>
> What need to make the git cola prompt the ssh password in a window popup?
> (like gitk)
>
> regards

I can take a look at what gitk is doing. In general, git supports the
SSH_ASKPASS environment variable. When asking for a password, ssh
will use the program named in $SSH_ASKPASS to provide a prompt to the
user.

I thought that we provided our own ssh-askpass implementation. I
wonder why it's not picking it up?... hmmm. I'll dig around a bit and
see what I can find.

Are you on Linux?
--
David

Jesus Eguiluz

unread,
Aug 23, 2012, 11:09:05 AM8/23/12
to git-...@googlegroups.com, Jesus Eguiluz
I'm using windows 7 x86.

if I set the SSH_ASKPASS whith the script in c:\program files\git-cola\share\git-cola\bin\ssh-askpass in windows environment it should work?

I will try.

regards

Jesus Eguiluz

unread,
Aug 24, 2012, 1:11:18 PM8/24/12
to git-...@googlegroups.com, Jesus Eguiluz
Does not work.

I set the SSH_ASKPASS variable whith the script in windows environment but does not work.

As a workaround I change all the shortcuts of git-cola (including windows registry) to use python.exe instead pythonw.exe, this show the console where can put the ssh password.

Regards

David Aguilar

unread,
Aug 25, 2012, 1:44:34 AM8/25/12
to Jesus Eguiluz, git-...@googlegroups.com
On Fri, Aug 24, 2012 at 10:11 AM, Jesus Eguiluz <jegu...@andeselec.com> wrote:
> Does not work.
>
> I set the SSH_ASKPASS variable whith the script in windows environment but
> does not work.

Thanks for the report, Jesus.

I am going to try passing:

preexec_fn=os.setsid

to subprocess.Popen() as described here:

http://stackoverflow.com/questions/1787288/how-to-call-ssh-by-subprocess-module-so-that-it-uses-ssh-askpass-variable

I have pushed the experimental change to the "win32" branch at
git://github.com/davvid/git-cola.git

https://github.com/davvid/git-cola/commits/win32

I would very much appreciate your testing, as I do not have windows handy.
Please let me know if that works. I have a feeling this was the missing magic.

I hope that helps,
--
David

Jesus Eguiluz

unread,
Aug 28, 2012, 11:18:59 AM8/28/12
to git-...@googlegroups.com, Jesus Eguiluz
I did the following:

I cloned the git repository git://github.com/davvid/git-cola.git

I copied the git.py to git-cola's installation dir.

I ran the git-cola and when opened a git local repo got the following error:

------------------------------------------------------------------------------------------------------------------------
Microsoft Windows [Versión 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.

C:\Users\gsusvm>C:\Python27\python.exe "C:\Program Files\git-cola\bin\git-cola.p
yw" --prompt --git-path "C:\Program Files\Git\bin\git.exe"
Traceback (most recent call last):
  File "C:\Program Files\git-cola\bin\git-cola.pyw", line 45, in <module>
    main('git-cola')
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\app.py", line 340, in
main
    view = MainView(model, qtutils.active_window())
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\main\view.py", line 83
, in __init__
    self.classic_dockable = (cfg.get('cola.browserdockable') or
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\gitcfg.py", line 192,
in get
    return self._get(self._all, key, default)
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\gitcfg.py", line 179,
in _get
    self.update()
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\gitcfg.py", line 110,
in update
    self._read_configs()
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\gitcfg.py", line 139,
in _read_configs
    self.read_config(self._config_files['user']))
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\gitcfg.py", line 152,
in read_config
    config_lines = self.git.config(*args).split('\0')
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\git.py", line 130, in
<lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\git.py", line 295, in
_call_process
    return self.execute(call, **_kwargs)
  File "C:\Program Files\git-cola\share\git-cola\lib\cola\git.py", line 191, in
execute
    preexec_fn=os.setsid,
AttributeError: 'module' object has no attribute 'setsid'

C:\Users\gsusvm>

------------------------------------------------------------------------------------------------------------------------
I not know if i do the correct only copying the git.py.

Maybe I need do something more.

Regards

David Aguilar

unread,
Aug 28, 2012, 2:08:26 PM8/28/12
to Jesus Eguiluz, git-...@googlegroups.com
On Tue, Aug 28, 2012 at 8:18 AM, Jesus Eguiluz <jegu...@andeselec.com> wrote:
> I did the following:
>
> I cloned the git repository git://github.com/davvid/git-cola.git
>
> I copied the git.py to git-cola's installation dir.
>
> I ran the git-cola and when opened a git local repo got the following error:
>
> ------------------------------------------------------------------------------------------------------------------------
> Microsoft Windows [Versión 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.
> [...snip...]
> File "C:\Program Files\git-cola\share\git-cola\lib\cola\git.py", line 295,
> in
> _call_process
> return self.execute(call, **_kwargs)
> File "C:\Program Files\git-cola\share\git-cola\lib\cola\git.py", line 191,
> in
> execute
> preexec_fn=os.setsid,
> AttributeError: 'module' object has no attribute 'setsid'

I suspected as much (Windows is always a special-case).


This thread has some suggestions that might help:

https://groups.google.com/forum/?fromgroups=#!topic/msysgit/5oCmfxHf6y4

I've updated the "win32" branch to throw away the latest commit.
There's only one commit in there now: it's a change to cola/app.py so
that it will honor (and by default set) GIT_ASKPASS.

Please let me know if the combination of the latest commit and the
suggestion to use GIT_SSH=plink (or some other combination mentioned
in the thread linked above) works for you. Whatever ends up working
is what I'll document so that others do not have to stumble through
these same steps.

Thanks for your patience, hopefully the suggestions from that thread
are the missing piece of the puzzle.
--
David
Reply all
Reply to author
Forward
0 new messages