duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

multiple netrc logins for github #417

Closed dannycochran closed 9 years ago

dannycochran commented 9 years ago

If I'm pulling two private repositories from separate organizations I would presumably have two logins for api.github.com -- but the last login listed in .netrc would overwrite any others, so duo would use the wrong login information for one of the repositories.

Is there a workaround to this?

stephenmathieson commented 9 years ago

I'm pretty sure this limitation is due to the .netrc, so there's not much Duo can do about it :/

dannycochran commented 9 years ago

I figured. Mine might be an edge case but it could be an argument for having other ways to authenticate access into private repositories.

stephenmathieson commented 9 years ago

After thinking about this a bit more, I'm confused. How do you handle this when just working with git? Do you have to use nasty .gitconfig hacks? IIRC, you can't use multiple SSH keys for a single host...

dannycochran commented 9 years ago

So there's two private repositories I want to pull down, each with separate API keys. One repo belongs to me and the other to my work. I'm a collaborator on the work repo, so doing any git operations just gets authenticated through my SSH keys. If that's what you're asking?

but my ~/.netrc file looks like this: machine api.github.com login dannycochran password <password> machine api.github.com login <work API login> password <password>

The second login overwrites the first, so I'm unable to pull down my repo. As you said, that's a .netrc limitation, but in this particular use case that means I can't easily ask duo to pull from repositories with separate API keys.

stephenmathieson commented 9 years ago

If git(1) can handle it all through a single account, why do you need two entries in your .netrc?

why not do:

machine api.github.com
  login dannycochran # assuming this the account with access to both repositories
  password <password>

??

dannycochran commented 9 years ago

I uhh.. uhm.. yes.

stephenmathieson commented 9 years ago

Haha glad we could figure this out :)