Added a comment: git-credential-netrc

This commit is contained in:
nick.guenther@e418ed3c763dff37995c2ed5da4232a7c6cee0a9 2022-09-08 02:02:40 +00:00 committed by admin
parent 4f3a33d824
commit 2c4c56ea50

View file

@ -0,0 +1,39 @@
[[!comment format=mdwn
username="nick.guenther@e418ed3c763dff37995c2ed5da4232a7c6cee0a9"
nickname="nick.guenther"
avatar="http://cdn.libravatar.org/avatar/9e85c6ca61c3f877fef4f91c2bf6e278"
subject="git-credential-netrc"
date="2022-09-08T02:02:39Z"
content="""
I've found a different workaround. `git` ships with an unmaintained(?) alternate netrc parser written in perl. You just need to install it:
```
[kousu@nigiri ~]$ sudo cp -p /usr/share/git/credential/netrc/git-credential-netrc.perl /usr/lib/git-core/git-credential-netrc # install
[sudo] password for kousu:
[kousu@nigiri ~]$ chmod 600 ~/.netrc # it's rightly picky about permissions
[kousu@nigiri ~]$ git config --global credential.helper \"netrc -v\"
[kousu@nigiri tmp.HBEKK9D4TS]$ cd $(mktemp -d)
[kousu@nigiri tmp.oZpfrzbN2N]$ git clone http://localhost/.git annex-test # this use ~/.netrc *directly*
Cloning into 'annex-test'...
[kousu@nigiri tmp.oZpfrzbN2N]$ cd annex-test/
[kousu@nigiri annex-test]$ git annex get # this uses ~/.netrc indirectly via git-credential
get large.bin (from origin...)
using gpg for GPG operations
Unable to read /home/kousu/.authinfo.gpg; skipping it
Unable to read /home/kousu/.netrc.gpg; skipping it
Unable to read /home/kousu/.authinfo; skipping it
Opening /home/kousu/.netrc...
ok
(recording state in git...)
```
This seems to sidestep the problem! It's weird that `git clone` will read netrc directly, but `git credential fill` won't? Oh well.
There's a [SO post](https://stackoverflow.com/a/31609584/2898673) about this script.
I still think it would be good for the docs and the code to be made consistent: if `web-options` is supposed to invoke curl then make it invoke curl, or else not the corner cases where it won't invoke curl.
Hope this helps someone out down the road.
"""]]