Skip to content
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

Passing credentials for git remotes #378

Closed
danhalligan opened this issue Jun 7, 2019 · 3 comments
Closed

Passing credentials for git remotes #378

danhalligan opened this issue Jun 7, 2019 · 3 comments

Comments

@danhalligan
Copy link
Contributor

danhalligan commented Jun 7, 2019

At present, as far as I can tell, it doesn't appear to be possible to pass credentials through to git:: Remotes (e.g. git::git@bitbucket.org:dannavarro/lsr-package.git). As such, functions like remote_sha will fail (since the remote constructed with parse_one_remote does not contain any credentials). Equally, package2remote will not specify any credentials if the remote is of type git2r.

This might be an unusual use case, but in our company we need to pass credentials for internally hosted git repositories. I've created a fork that works for us. You can see the relevant diff here:
danhalligan@be9ab58

Effectively, I pass credentials from through various functions in deps.R with ... and also use git2r::cred_ssh_key() to specify default credentials when running package2remote for a git2r remote type.

I'm willing to believe that this implementation is not a general solution (since not all git dependencies will necessarily require the same credentials), but I'd be interested in a possible general solution if possible.

Related: #146 #266

@jimhester
Copy link
Member

jimhester commented Jun 7, 2019

Yeah we can't just pass the dots, that is how this used to work, but it breaks down when you have remotes coming from different sources.

We don't currently have a great way to solve this problem unfortunately.

@danhalligan
Copy link
Contributor Author

danhalligan commented Jun 7, 2019

I'd noticed that issue. One option I'd considered was stripping out source from the remote specification (so bitbucket.org in the case of git::git@bitbucket.org:dannavarro/lsr-package.git) and providing the ability to specify credentials for specific sources flexibly as an environment variable.

@danhalligan
Copy link
Contributor Author

danhalligan commented Jun 21, 2019

Awesome - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants