From 71e7f5523d868cf0f1a9334ca066ec13819fabac Mon Sep 17 00:00:00 2001 From: Claudius Heine Date: Thu, 6 May 2021 11:31:12 +0200 Subject: [PATCH] kas: add GIT_CREDENTIAL_HELPER environment variable This allows to set a git credential helper in the .gitconfig, in order to handle git authentications. For instance when bitbake recipes require to clone from git via https. Signed-off-by: Claudius Heine Signed-off-by: Jan Kiszka --- docs/command-line.rst | 4 ++++ kas/libcmds.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/docs/command-line.rst b/docs/command-line.rst index d2a7298..91e4d6f 100644 --- a/docs/command-line.rst +++ b/docs/command-line.rst @@ -68,5 +68,9 @@ Environment variables | ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials | | |aws_cred| | file that are copied to the kas home dir. | +-----------------------+-----------------------------------------------------+ +| |git_cred| | Allows to set the git credential helper in the | +| | `.gitconfig` of the kas user. | ++-----------------------+-----------------------------------------------------+ .. |aws_cred| replace:: ``AWS_SHARED_CREDENTIALS_FILE`` +.. |git_cred| replace:: ``GIT_CREDENTIAL_HELPER`` diff --git a/kas/libcmds.py b/kas/libcmds.py index d084567..9f43955 100644 --- a/kas/libcmds.py +++ b/kas/libcmds.py @@ -164,6 +164,11 @@ class SetupHome(Command): fds.write('[User]\n' '\temail = kas@example.com\n' '\tname = Kas User\n') + if os.environ.get('GIT_CREDENTIAL_HELPER', False): + fds.write('[credential]\n' + '\thelper = ' + + os.environ.get('GIT_CREDENTIAL_HELPER') + + '\n') if os.environ.get('AWS_CONFIG_FILE', False) \ and os.environ.get('AWS_SHARED_CREDENTIALS_FILE', False):