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

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

问题描述

当我这样做时:

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

我收到此错误:

致命:HTTP请求失败

fatal: HTTP request failed

当我使用SSH时:

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

我收到此错误:

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

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

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

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

推荐答案

您的ssh clone语句错误:git clone username git@example.com:root/test.git

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

该语句将尝试将名为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.

您想忽略username:

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

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

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