lambda-git icon indicating copy to clipboard operation
lambda-git copied to clipboard

Feature Request: Ability to pass credentials

Open samuba opened this issue 6 years ago • 3 comments

Right now the it seems that the only way to pass credentials to a command ist to have them in the url. eg. https://user:[email protected]. That's sadly not enough for me as it looks like Github is not allowing Personal Access Tokens as password in urls. It would be great to have the ability to just pass username, password combo to exec_command or have them read out of some environment variables.

samuba avatar Feb 22 '19 17:02 samuba

Got it working in the end via GIT_ASKPASS variable and a corresponding script: https://github.com/codeforamerica/git-jekyll-preview/blob/master/askpass.py

samuba avatar Feb 25 '19 17:02 samuba

@samuba Thank you very much for this! I am busy writing a Lambda function that is packaged using AWS SAM, and automated using a Jenkinsfile. I am having the same problems with the credentials while running Lambda Git within my Python function.

I tried the credential helper, but this isn't working (debugging now). I tried just setting username/pass as env vars in the format they describe on the Lambda Git page using commit_env = os.environ and then commit_env['GIT_AUTHOR_NAME'], etc... But this also didn't work.

GusPollard avatar May 02 '19 07:05 GusPollard

@samuba So when you use this, you define GIT_ASKPASS, using commit_env['GIT_ASKPASS'] correct?

Then this env var has to point to the askpass.py script that you have written above? I need to figure out how I am going to use this while building my function using AWS SAM however...

After that, you then need to use env=commit_env at the end of git.exec_command?

Sorry for all the questions man, I just want to ensure I can get this working using your way.

Thank you again!

GusPollard avatar May 02 '19 07:05 GusPollard