using gitlab token to clone without authentication

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

    The gitlab has a lot of tokens:

    • Private token
    • Personal Access Token
    • CI/CD running token

    I tested only the Personal Access Token using GitLab Community Edition 10.1.2, the example:

    git clone https://gitlab-ci-token:${Personal Access Tokens}@gitlab.com/username/myrepo.git
    
    
    git clone https://oauth2:${Personal Access Tokens}@gitlab.com/username/myrepo.git
    

    or using username and password:

    git clone https://${username}:${password}@gitlab.com/username/myrepo.git
    

    or by input your password:

    git clone https://${username}@gitlab.com/username/myrepo.git
    

    But the private token seems can not work.

提交回复
热议问题