using gitlab token to clone without authentication

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

    You can do it like this:

    git clone https://gitlab-ci-token:<private token>@git.example.com/myuser/myrepo.git
    
    0 讨论(0)
  • 2020-11-28 18:46

    many answers above are close, but they get ~username syntax for deploy tokens incorrect. There are other types of tokens, but the deploy token is what gitlab offers (circa 2020+ at least) per repo to allow customized access, including read-only.

    from a repository (or group), find the settings --> repository --> deploy tokens. Create a new one. A username and token field are created. The username is NOT a fixed value by default; it's unique to this token.

    git clone https://<your_deploy_token_username>:<the_token>@gitlab.com/your/repo/path.git

    tested on gitlab.com public, free account.

    0 讨论(0)
提交回复
热议问题