I'm trying to authenticate with ADO so I can install one of remote requirements for my python app. This is what works locally:
RUN git config --global credential.helper 'cache'; echo "protocol=https\n\
host=dev.azure.com\n\
username=${AZURE_USERNAME}\n\
password=${AZURE_PASSWORD}" | \
git credential approve && \
pip install --no-cache-dir --upgrade pip setuptools && \
pip install --no-cache-dir -r /tmp/requirements/requirements-remote.txt
However, this uses auto-generated credentials (temporary password). SSH doesn't work in our use case. How do I go about this so I don't have to update my password every single time on pipeline run?
CodePudding user response:
Use a personal access token (PAT)
MY_PAT=yourPAT # replace "yourPAT" with ":PatStringFromWebUI"
B64_PAT=$(printf "%s"":$MY_PAT" | base64)
git -c http.extraHeader="Authorization: Basic ${B64_PAT}" clone https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName