This is a short description of how to get git
credentials in an EC2 instance set-up for CI/CD scripts. In the following scripts, we do the following:
- Install the AWS CLI. See here for description of steps on Linux.
- Install
jq
to parse the JSON output from CLI. - Run the
aws
CLI forssm
(AWS Systems Manager) to extract parameter values forgit
user. - Set the
git
user name globally. - Set the name of the script in
GIT_ASKPASS
that will return thegit
password.
To use the script, first, add the following parameters in AWS Systems Manager. Then, set CREDS_SCRIPT
to a location where git-pass.sh
can be reached. Run git-creds.sh
.
Parameter name | Value |
---|---|
GIT_USER |
Git user name |
GIT_PASSWORD |
Git password |