Re: Git GUI vs interactive post-commit hooks
On 2008.05.19 14:48:14 +0400, Alexander Gladysh wrote:
Show 14 quoted lines
> Hi, list!
>
> $ git --version
> git version 1.5.5.1
>
> I have a post-commit hook which does backups for me:
>
> username=agladysh
> for name in `git branch | cut -b3-`
> do
> remote=$username-$name
> echo pushing $name as $remote
> git push backup +$name:refs/heads/$remote
> done
Isn't that what "git push --all" does? And that will only ask for a password once, not for every branch.
Show 7 quoted lines
> The backup repo is behind ssh. Recently I have put password on my ssh
> key and post-commit hook ask me for password once for each branch.
> This makes unhappy commit process from Git GUI -- after I shut it
> down, there are multiple ssh key password prompts in the shell from
> where I launched it, and it does not display any input I enter.
>
> Any advice? I do want to input password for my key each time I use it.
For a graphical tool, you might want to use something like gtk-led-askpass, which shows a window with a password prompt. SSH will make use of it if SSH_ASKPASS contains its path _and_ ssh is not started from a terminal. Unfortunately, the latter is probably not true for git gui most of the time.
One way hack around this is to do "setsid git push ..." in your post-commit hook. But that will break if you have no X or no tool for SSH_ASKPASS.
Another really hackish work-around is to
replace:
exec 'wish' "$argv0" -- "$@"
with
exec 'setsid' 'wish' "$argv0" -- "$@"
in git-gui. Git gui will then get its own session, detached from the terminal and ssh will start using SSH_ASKPASS. That at least won't break when you're not running X (simply because you won't be running git gui then ;-)), but doesn't feel smart either.
Maybe someone else can come up with a sane solution that makes git gui more SSH_ASKPASS-friendly.
Björn