命令行拉取Github私密仓库

使用命令行拉取 GitHub 私密仓库,需要先在本地生成 SSH key 并将其添加到 GitHub 账户中,然后使用 git clone 命令克隆仓库,命令格式为:git clone [email protected]:username/repository.git 要拉取私密仓库,您需要先使用 SSH 密钥进行身份验证。 生成 SSH 密钥:在命令行中运行 。 ssh-keygen -t rsa -b 4096 -C "[email protected]" 将公钥添加到 GitHub 中: 在 GitHub 上打开“Settings”,然后在“SSH and GPG keys”部分中点击“New SSH key”。 在 key 中将本地生成的 id_rsa.pub 文件内的内容复制到 key 输入框中,然后 title 随便输入,点击保存即可。 从远程库克隆私密仓库: git clone [email protected]:USERNAME/REPOSITORY.git 注意:替换 USERNAME 和 REPOSITORY 为相应的用户名和仓库名称。

2023年1月14日 · 1 分钟 · 诚哥博客