如何克隆私有 GitLab 存储库? [英] How can I clone a private GitLab repository?

查看:60
本文介绍了如何克隆私有 GitLab 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我这样做时:

git clone https://example.com/root/test.git

我收到此错误:

<块引用>

致命:HTTP 请求失败

当我使用 SSH 时:

git clone 用户名 git@example.com:root/test.git

我收到此错误:

<块引用>

在/server/user/git@example.com:root/test.git/.git/中初始化空的Git仓库
致命:用户"似乎不是 git 存储库
致命:远端意外挂断

这是一个私有存储库,我已经添加了我的 SSH 密钥.

解决方案

You have your ssh clone 语句错误: git clone username git@example.com:root/test.git

该语句将尝试将名为 username 的存储库克隆到相对于您当前路径的位置,git@example.com:root/test.git.>

您想省略用户名:

git clone git@example.com:root/test.git

When I do this:

git clone https://example.com/root/test.git

I am getting this error:

fatal: HTTP request failed

When I use SSH:

git clone username git@example.com:root/test.git

I am getting this error:

Initialized empty Git repository in /server/user/git@example.com:root/test.git/.git/
fatal: 'user' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

It's a private repository, and I have added my SSH keys.

解决方案

You have your ssh clone statement wrong: git clone username git@example.com:root/test.git

That statement would try to clone a repository named username into the location relative to your current path, git@example.com:root/test.git.

You want to leave out username:

git clone git@example.com:root/test.git

这篇关于如何克隆私有 GitLab 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆