authinfo file for github

177 views
Skip to first unread message

Julien Cubizolles

unread,
Feb 13, 2013, 5:12:40 PM2/13/13
to ma...@googlegroups.com
I'm a new (and happy) user of magit. I've tried to add login/password to
my .authinfo file to save typing it at each git operation but couldn't
figure out the right syntax.

Here is what I tried.
--8<---------------cut here---------------start------------->8---
machine github.com protocol https login *mylogin* password *mypassword*
--8<---------------cut here---------------end--------------->8---

Julien.

Rémi Vanicat

unread,
Feb 14, 2013, 4:17:46 AM2/14/13
to Julien Cubizolles, ma...@googlegroups.com
Julien Cubizolles <j.cubi...@free.fr> writes:

> I'm a new (and happy) user of magit. I've tried to add login/password to
> my .authinfo file to save typing it at each git operation but couldn't
> figure out the right syntax.
> Here is what I tried.
> machine github.com protocol https login *mylogin* password
> *mypassword*

We didn't yet wrote the code needed for magit to use standard Emacs
authentication, so there is nothing you can do, but wrote the code
yourself, or wait for some good man to do it.

I use ssh and ssh-agent for this, so I've to enter only once a
passphrase for all my git activities (on github and elsewhere)
--
Rémi Vanicat

Ted Zlatanov

unread,
Feb 20, 2013, 7:44:51 PM2/20/13
to ma...@googlegroups.com
On Thu, 14 Feb 2013 10:17:46 +0100 R�mi Vanicat <remi.v...@gmail.com> wrote:

RV> Julien Cubizolles <j.cubi...@free.fr> writes:
>> I'm a new (and happy) user of magit. I've tried to add login/password to
>> my .authinfo file to save typing it at each git operation but couldn't
>> figure out the right syntax.
>> Here is what I tried.
>> machine github.com protocol https login *mylogin* password
>> *mypassword*

RV> We didn't yet wrote the code needed for magit to use standard Emacs
RV> authentication, so there is nothing you can do, but wrote the code
RV> yourself, or wait for some good man to do it.

RV> I use ssh and ssh-agent for this, so I've to enter only once a
RV> passphrase for all my git activities (on github and elsewhere)

Hello Julien and R�mi,

the Git credential helper protocol is good enough to handle this. On
the git developer mailing list I have proposed a netrc credential helper
that will look up login name and password from a .authinfo/.netrc file
(using GPG if it has the .gpg suffix). It's OK mostly, except I still
have to write tests for it, so I'd expect it to make it into an upcoming
Git release, and it's in contrib/ so it can be pulled out for standalone
use. Julien, if you're interested, you can look at the patch and test
it out for yourself.

Practically, the application of the netrc credential helper is that all
the wrappings of Emacs' auth-source.el will not be needed. Git itself
respects the GIT_CONFIG environment variable, so Magit could pass a
special gitconfig file with the netrc credential helper specified, but I
think it's better to make the user handle it and document it. Either
way, Git will consult the netrc credential helper, which takes the
problem off Magit's hands. I think that's the right approach with Git
because it's an external tool.

The best part of this solution is that the netrc credential helper is
just one of many. The user could choose to use the GNOME Keyring, the
Secrets API, or the Mac OS X keychain through the appropriate credential
helper. Magit and Emacs don't have to care.

Ted

Ted Zlatanov

unread,
Mar 5, 2013, 5:05:36 AM3/5/13
to ma...@googlegroups.com
On Wed, 20 Feb 2013 19:44:51 -0500 Ted Zlatanov <t...@lifelogs.com> wrote:

TZ> On Thu, 14 Feb 2013 10:17:46 +0100 R�mi Vanicat <remi.v...@gmail.com> wrote:
RV> Julien Cubizolles <j.cubi...@free.fr> writes:
>>> I'm a new (and happy) user of magit. I've tried to add login/password to
>>> my .authinfo file to save typing it at each git operation but couldn't
>>> figure out the right syntax.
>>> Here is what I tried.
>>> machine github.com protocol https login *mylogin* password
>>> *mypassword*

RV> We didn't yet wrote the code needed for magit to use standard Emacs
RV> authentication, so there is nothing you can do, but wrote the code
RV> yourself, or wait for some good man to do it.

RV> I use ssh and ssh-agent for this, so I've to enter only once a
RV> passphrase for all my git activities (on github and elsewhere)

TZ> Hello Julien and R�mi,

TZ> the Git credential helper protocol is good enough to handle this. On
TZ> the git developer mailing list I have proposed a netrc credential helper
TZ> that will look up login name and password from a .authinfo/.netrc file
TZ> (using GPG if it has the .gpg suffix). It's OK mostly, except I still
TZ> have to write tests for it, so I'd expect it to make it into an upcoming
TZ> Git release, and it's in contrib/ so it can be pulled out for standalone
TZ> use. Julien, if you're interested, you can look at the patch and test
TZ> it out for yourself.

TZ> Practically, the application of the netrc credential helper is that all
TZ> the wrappings of Emacs' auth-source.el will not be needed. Git itself
TZ> respects the GIT_CONFIG environment variable, so Magit could pass a
TZ> special gitconfig file with the netrc credential helper specified, but I
TZ> think it's better to make the user handle it and document it. Either
TZ> way, Git will consult the netrc credential helper, which takes the
TZ> problem off Magit's hands. I think that's the right approach with Git
TZ> because it's an external tool.

TZ> The best part of this solution is that the netrc credential helper is
TZ> just one of many. The user could choose to use the GNOME Keyring, the
TZ> Secrets API, or the Mac OS X keychain through the appropriate credential
TZ> helper. Magit and Emacs don't have to care.

The Git netrc credential helper is in Git's `next' branch so it can be
expected to show up in the next release. Give it a try and let me know
if it works for you, please.

Ted

Reply all
Reply to author
Forward
0 new messages