-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add netrc support for LFS API requests #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lfs/credentials.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's worth caching this in the global lfs.Config object? Looks like this is called for every API request, so it could be used multiple times in a single git-lfs process (especially with the legacy API).
|
I added central caching of the |
|
This looks good, but I'm going to hold it back from v1.1 until that can be checked out, and the netrc feature itself can be tested a bit more. Should be a shoe-in for v1.2 though. |
|
It hangs because I think I usually see them as |
|
Doh, good catch. On Wed, Nov 18, 2015 at 11:47 AM, Scott Barron notifications@github.com
Rick Olson |
Instead of a blank var in the main config with values set by init() in build flag protected files, the build flagged files should create the var. This prevents cases where no build flagged file builds leaving an empty netrc basename causing auth failures. This also renames the file config_linux.go to config_nix.go because it should build on all unix-y platforms.
|
I pushed a change that renames the file, but also changes the way the variable is set. Instead of a var + init() in the build flagged files, the build flagged files should define the variable. With this pattern, the build would have failed immediately because nothing defined |
Add netrc support for LFS API requests
Support for reading and parsing ".netrc" files (or "_netrc" files on Windows) was first added to the Git LFS client in PR git-lfs#715, and the parsing code was later moved into our "config" package in PR git-lfs#1226. Subsequently, almost identical parsing code was also added to our "lfsapi" package in commit 2275188 of PR git-lfs#1839, which was later moved to its current location in our "creds" package in PR git-lfs#3307. Meanwhile, the only caller of the original ".netrc" parser, which was implemented in the parseNetrc() method of the Configuration structure in our "config" package, was removed in commit afcd211 PR git-lfs#1846. As a consequence, since PR git-lfs#1846 the parseNetrc() method in the "config" package has remained unused, along with the related "netrcfinder" interface and associated structure and method in the same source file, so we can simply delete that file now.
This PR adds support for using netrc for LFS API requests. The priority becomes:
TODO:
//cc #705