0
点赞
收藏
分享

微信扫一扫

git - - - 克隆仓库时输入指定账号和密码

_铁马冰河_ 2024-08-25 阅读 22

1. 使用 HTTPS 进行克隆

如果克隆的远程仓库使用 HTTPS 协议,那么在克隆的过程中需要输入账号密码。

在命令行中执行 git clone 命令时,会提示输入账号和密码,可以按照如下格式直接输入:

git clone https://username:password@remote_repository_url

例如:

git clone https://zichenlbl:password@github.com/zichenlbl/gitignore.git

其中,username 是你的账号,password 是你的密码,remote_repository_url 是去掉 https:// 后远程仓库的 URL。

这种方式不仅适用于克隆操作,也适用于其他需要验证身份的操作,比如 push、pull 等。

举报

相关推荐

0 条评论