【发布时间】:2018-02-20 18:33:34
【问题描述】:
这篇文章中的这个解决方案不起作用How to provide username and password when run "git clone git@remote.git"?
git clone https://username:password@github.com/username/repository.git
致命:无法访问'http://..:无法解析主机:用户名
【问题讨论】:
这篇文章中的这个解决方案不起作用How to provide username and password when run "git clone git@remote.git"?
git clone https://username:password@github.com/username/repository.git
致命:无法访问'http://..:无法解析主机:用户名
【问题讨论】:
Gitlab 不支持在一行中使用 http 进行克隆。也许你可以用 ssh 来做?
有一些 git 服务可以在一行中使用 http 克隆。例如 Github 和 Gitorious。 我认为 Gitlab 只支持用户名前缀。总是会询问密码。这也带来了巨大的安全优势,因为通过这种方式,您的密码永远不会存储在日志文件中。
【讨论】:
是的,你可以。语法是:
git clone https://username:token@gitlab.com/user/repo.git
username 是您的 Gitlab 用户名,token 是通过您的 gitlab 的 settings > Access Tokens
【讨论】: