Gitlab使用api克隆私有repo git克隆https://gitlab.com:@gitlab.com/myuser/myrepo.git

Gitlab使用api克隆私有repo git克隆https://gitlab.com:@gitlab.com/myuser/myrepo.git,gitlab,Gitlab,尝试克隆专用存储库时出现错误“致命:身份验证失败” 我做错了什么?通常,私有令牌用于gitlab ci令牌: git clone https://gitlab.com:<private token>@gitlab.com/myuser/myrepo.git git克隆https://gitlab-ci-token:@gitlab.com/myuser/myrepo.git 请参阅。确保您已经在Gitlab帐户上创建了一个个人访问令牌,可以访问api作用域。此外,令牌不得过期 我用

尝试克隆专用存储库时出现错误“致命:身份验证失败”


我做错了什么?

通常,私有令牌用于
gitlab ci令牌

git clone https://gitlab.com:<private token>@gitlab.com/myuser/myrepo.git
git克隆https://gitlab-ci-token:@gitlab.com/myuser/myrepo.git

请参阅。

确保您已经在Gitlab帐户上创建了一个个人访问令牌,可以访问api作用域。此外,令牌不得过期

我用这个为我工作:

git clone https://gitlab-ci-token:<private token>@gitlab.com/myuser/myrepo.git
git克隆https://gitlab.com:@gitlab.com/user/repo.git'

仅供参考:我没有设置双因素身份验证(2FA),如果您在帐户中设置了2FA,这可能是您的问题。

gitlab有很多令牌、私有令牌、个人访问令牌、CI/CD运行令牌, 我仅使用GitLab Community Edition 10.1.2测试Persion访问令牌,示例如下:

git clone https://gitlab.com:<personal_access_token>@gitlab.com/user/repo.git' 

这种方法很有魅力。如果您启用了双因素身份验证(2FA),只要令牌权限设置为“api”,它就可以工作。
git clone https://gitlab-ci-token:${Personal Access Tokens}@gitlab.com/username/myrepo.git