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

Re: [PATCH] send-email: Add support for SSL and SMTP-AUTH

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 2, 2007, 07:55 UTC
Message-ID
<7vveatpklg.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<11887028854022-git-send-email-doug@11011.net>
Thanks for the patch.  I think SMTP-AUTH is a worthy addition.

I however have a bit of reservation about making the password itself a configuration variable. I understand this is good enough for the simplest case that you have only single e-mail identity and mailserver to talk to.

By defining the two "default" variables, you are encouraging users who want to use different identity per project to define the smtpauthuser and smtpauthpass variables in .git/config of each repository. I see two issues with this.

 (1) Suppose I interact with under one mail identity with
     projects A and B and under another mail identity with
     project C and D.  I need to have duplicate variable
     settings in .git/config of A and B for one and another
     duplicated sets in C and D.
 (2) Although the recommended BCP is not to allow other people
     to interact with your private working repository (iow, you
     keep a separate "bare" repository you use solely for
     publishing, you push from your private working repository
     to that publishing repository, and have others look at only
     the publishing repository), people often do not follow this
     BCP and expose their private working repository to their
     colleages for fetching (or even pushing).  We currently do
     not allow reading remote repository's configuration over
     the git protocol, but there were some cases in the past
     that the ability to do so might lead to their solutions
     discussed on the list.  We might not keep .git/config in
     the repository that is accessed by fetch clients private in
     the future.

So it might be better to split the configuration variables in this way:

 (1) in ~/.gitconfig (that is hopefully readable only by the
     user):
	[sendemail "default"]
        	server = mail.isp.com
                user = junkio
                pass = junkio-password-for-mail-isp-com
	[sendemail "git"]
        	server = mail.git.xz
                user = gitster
                pass = gitster-password-for-mail-git.xz
     This defines two "mail identities" I could use, depending
     on which project's repository I run send-email.
 (2) in project/.git/config:
	[sendemail]
        	identity = git
     This defines which "mail identity" I want to use for this
     particular project.

This way, you can maintain more than one identity by having multiple [sendemail "$identity"] sections in ~/.gitconfig, and avoid having to expose and duplicate user/pass in various project's .git/config.

The look-up rules by send-email program would be:
 * if anything is given explicitly from the command line, use
   that; otherwise
 * if sendemail.identity does not exist, pretend
   "sendemail.identity = default" was given (let's call that
   identity nickname $identity in the following);
   * if sendemail.$identity.server.exists, use that as the smtp
     server to contact; otherwise sendemail.smtpserver is used;
   * for user/pass information, use sendemail.$identity.user and
     sendemail.$identity.pass.
Hmm?
Previous: Douglas StockwellNext: Wincent Colaiuta
Message 2 of 5 in “send-email: Add support for SSL and SMTP-AUTH”
  1. send-email: Add support for SSL and SMTP-AUTHDouglas Stockwell, Sep 2, 2007
  2. Junio C HamanoSep 2, 2007
  3. Wincent ColaiutaSep 2, 2007
  4. David SymondsSep 2, 2007
  5. Johannes SchindelinSep 2, 2007

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.