git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git GUI vs interactive post-commit hooks

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
May 19, 2008, 14:11 UTC
Message-ID
<20080519141112.GA12304@atjola.homenet>
In-Reply-To
<c6c947f60805190642x7d44ef04h4090cbb687de69e@mail.gmail.com>
On 2008.05.19 17:42:05 +0400, Alexander Gladysh wrote:
Show 22 quoted lines
> On Mon, May 19, 2008 at 5:19 PM, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> > On 2008.05.19 14:48:14 +0400, Alexander Gladysh wrote:
> >> 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.
> 
> git push --all would not rename my branches... But, I guess, this can
> be done as preparation step somehow.
Oh, oops, didn't notice the $remote stuff, sorry.
Show 19 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.
> 
> <Useful advice regarding how to solve SSH_ASKPASS issue skipped.>
> 
> Thanks, I would try that. I'm mostly working from X, so lack of X
> should be not an issue... However I'd like to avoid patching my local
> copy of git as much as possible. :-)

Well, the "lack of X" issue only arises if you patch your post-commit hook. Adding setsid to the git push command was supposed to happen there ;-) You could probably even make that conditional, so that setsid is only used then DISPLAY is set, then it should even work when there's no X, but still be annoying when you commit from a terminal... (At least I would prefer to enter the password in the terminal then).

Björn
Previous: Alexander GladyshNext: Alex Riesen
Message 4 of 9 in “Git GUI vs interactive post-commit hooks”
  1. Alexander GladyshMay 19, 2008
  2. Björn SteinbrinkMay 19, 2008
  3. Alexander GladyshMay 19, 2008
  4. Björn SteinbrinkMay 19, 2008
  5. Alex RiesenMay 20, 2008
  6. Björn SteinbrinkMay 20, 2008
  7. Jeff KingMay 20, 2008
  8. Alex RiesenMay 22, 2008
  9. Björn SteinbrinkMay 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.