I'm building a Tekton task on Openshift pipelines and trying to clone the source code from my GIT repository. I'm cloning the repo in my script using the below
git clone 'https://[PAT]@tfs.**.com/[org]/[project]/_git/[repo]'
but always getting the error below
fatal: could not read password for 'https://[PAT]@tfs.**.com' no such device or address
I created a secret with the username and password(PAT) and added the secret to pipeline service account but still getting the same error. I searched a lot about the issue and nothing from all the solutions I found worked with me.
When you are accessing protected github repo from Openshift pipelines check the following (I'm using the built in git-clone
cluster task):
kind: Secret
apiVersion: v1
metadata:
name: git-token
annotations:
tekton.dev/git-0: 'https://yourrepo.com'
stringData:
password: YOURTOKEN
username: anything
type: kubernetes.io/basic-auth
https://
in annotation is critical, I had the same error as you when I just had hostname.
pipeline
service account in secret section, similar to this:secrets:
- name: pipeline-dockercfg-tqdxx
- name: git-token