using gitlab token to clone without authentication

前端 未结 14 2712
失恋的感觉
失恋的感觉 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:36

    These days (Oct 2020) you can use just the following

    git clone $CI_REPOSITORY_URL
    

    Which will expand to something like:

    git clone https://gitlab-ci-token:[MASKED]@gitlab.com/gitlab-examples/ci-debug-trace.git
    

    Where the "token" password is ephemeral token, it should be revoked after a build is complete.

提交回复
热议问题