mbox series

[0/2] contrib/credential/netrc: Makefile + script cleanup

Message ID cover.1576531851.git.liu.denton@gmail.com (mailing list archive)
Headers show
Series contrib/credential/netrc: Makefile + script cleanup | expand

Message

Denton Liu Dec. 16, 2019, 9:32 p.m. UTC
I recently switched my workflow to use this credential helper and I
noticed a couple of problems:

1. The interpreter path was hardcoded to #!/usr/bin/perl

2. The script refuses to run outside of a Git repository

This patch series should fix these problems.

Denton Liu (2):
  contrib/credential/netrc: make PERL_PATH configurable
  contrib/credential/netrc: work outside a repo

 contrib/credential/netrc/.gitignore           |  1 +
 contrib/credential/netrc/Makefile             | 26 +++++++++++++++++--
 ...ential-netrc => git-credential-netrc.perl} |  2 +-
 3 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 contrib/credential/netrc/.gitignore
 rename contrib/credential/netrc/{git-credential-netrc => git-credential-netrc.perl} (99%)

Comments

Jeff King Dec. 17, 2019, 2:48 a.m. UTC | #1
On Mon, Dec 16, 2019 at 01:32:32PM -0800, Denton Liu wrote:

> I recently switched my workflow to use this credential helper and I
> noticed a couple of problems:
> 
> 1. The interpreter path was hardcoded to #!/usr/bin/perl
> 
> 2. The script refuses to run outside of a Git repository
> 
> This patch series should fix these problems.

Both of these patches look good to me.

It does make me wonder if many people are using credential-netrc, given
these pretty obvious problems. You're certainly welcome to use it if it
works for you, but I am curious what made you pick it versus one of the
other more advanced helpers.

I assume you're using a gpg-encrypted netrc (if not, you should probably
just use credential-store). For "read-only" password access, I find the
combination of pass[1] with config like this is a bit nicer:

  [credential "https://github.com"]
  username = peff
  helper = "!f() { test $1 = get && echo password=`pass github/oauth`; }; f"

-Peff

[1] https://www.passwordstore.org/
Denton Liu Dec. 17, 2019, 6:17 a.m. UTC | #2
Hi Peff,

On Mon, Dec 16, 2019 at 09:48:58PM -0500, Jeff King wrote:
> On Mon, Dec 16, 2019 at 01:32:32PM -0800, Denton Liu wrote:
> 
> > I recently switched my workflow to use this credential helper and I
> > noticed a couple of problems:
> > 
> > 1. The interpreter path was hardcoded to #!/usr/bin/perl
> > 
> > 2. The script refuses to run outside of a Git repository
> > 
> > This patch series should fix these problems.
> 
> Both of these patches look good to me.

Thanks for reviewing :)

> 
> It does make me wonder if many people are using credential-netrc, given
> these pretty obvious problems. You're certainly welcome to use it if it
> works for you, but I am curious what made you pick it versus one of the
> other more advanced helpers.

I wanted a credential helper that was encrypted and OS-independent.
Since GPG is basically available on everything, it fits my use case.

It also helped that it resulted in a workflow that was very similar to
my old mutt workflow. Before, I had

	source "gpg -dq ~/.mutt/credentials.gpg |"

and I just replaced the gpg with a script that wraps around git-credential.

> 
> I assume you're using a gpg-encrypted netrc (if not, you should probably
> just use credential-store). For "read-only" password access, I find the
> combination of pass[1] with config like this is a bit nicer:

Nice, I never knew heard about pass until now. I only have one password
in my credential store currently but if I need to add more, I'll keep
this in mind!

-Denton

> 
>   [credential "https://github.com"]
>   username = peff
>   helper = "!f() { test $1 = get && echo password=`pass github/oauth`; }; f"
> 
> -Peff
> 
> [1] https://www.passwordstore.org/