有没有一种方法可以在一个命令中使用用户名和密码从gitlab克隆?

mbo*_*nin 2 git bash git-bash gitlab

此帖子中的解决方案不起作用运行“ git clone git@remote.git”时如何提供用户名和密码?

git clone https://username:password@github.com/username/repository.git
Run Code Online (Sandbox Code Playgroud)

严重:无法访问“ http:/ ..:无法解析主机:用户名

Joh*_*ohn 6

是的你可以。语法为:

git clone https://username:token@gitlab.com/user/repo.git
Run Code Online (Sandbox Code Playgroud)

username您的Gitlab用户名在哪里,并token通过gitlab的设置>访问令牌生成