using gitlab token to clone without authentication

前端 未结 14 2714
失恋的感觉
失恋的感觉 2020-11-28 17:56

I want to clone gitlab repository without prompt for my automation script, by using my private token from my gitlab account.

Can someone provide me a sample?

<
14条回答
  •  甜味超标
    2020-11-28 18:25

    Inside a GitLab CI pipeline the CI_JOB_TOKEN environment variable works for me:

    git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/...
    

    Source: Gitlab Docs

    BTW, setting this variable in .gitlab-ci.yml helps to debug errors.

    variables:
        CI_DEBUG_TRACE: "true"
    

提交回复
热议问题