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
jqto parse the JSON output from CLI. - Run the
awsCLI forssm(AWS Systems Manager) to extract parameter values forgituser. - Set the
gituser name globally. - Set the name of the script in
GIT_ASKPASSthat will return thegitpassword.
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 |