max*_*oku 31 git github gitlab
当我这样做:
git clone https://example.com/root/test.git
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
致命:HTTP请求失败
当我使用SSH时:
git clone username git@example.com:root/test.git
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
/server/user/git@example.com:root/test.git/.git/
致命的初始化空Git存储库:'user'似乎不是git存储库
致命:远程端意外挂断
它是一个私有存储库,我添加了SSH密钥.
DrC*_*ord 29
你的ssh clone
声明错了:git clone username git@example.com:root/test.git
该语句将尝试克隆一个名为username
相对于当前路径的位置的存储库git@example.com:root/test.git
.
你想省略username
:
git clone git@example.com:root/test.git
Run Code Online (Sandbox Code Playgroud)
gar*_*ryp 29
如果您正在使用GitHub尝试此操作,则可以使用您输入的SSH执行此操作:
git clone https://username@github.com/username/repository
Run Code Online (Sandbox Code Playgroud)
Uli*_*uri 24
对于GitLab,基于HTTPS的克隆似乎没有直接的解决方案.因此,如果您需要基于SSH的克隆,则应考虑以下三个步骤:
使用您用于注册的电子邮件正确创建SSH密钥.我会使用默认文件名来键入Windows.别忘了介绍密码!
$ ssh-keygen -t rsa -C "your.email@example.com" -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key ($PWD/.ssh/id_rsa): [\n]
Enter passphrase (empty for no passphrase):[your password]
Enter same passphrase again: [your password]
Your identification has been saved in $PWD/.ssh/id_rsa.
Your public key has been saved in $PWD/.ssh/id_rsa.pub.
Run Code Online (Sandbox Code Playgroud)将最近id_rsa.pub
生成的所有内容复制并粘贴到GitLab配置文件中的设置> SSH密钥>密钥中.
获取本地连接:
$ ssh -i $PWD/.ssh/id_rsa git@gitlab.com
Enter passphrase for key "$PWD/.ssh/id_rsa": [your password]
PTY allocation request failed on channel 0
Welcome to GitLab, you!
Connection to gitlab.com closed.
Run Code Online (Sandbox Code Playgroud)最后,克隆任何私有或内部GitLab存储库!
$ git clone https://git.metabarcoding.org/obitools/ROBIBarcodes.git
Cloning into 'ROBIBarcodes'...
remote: Counting objects: 69, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 69 (delta 14), reused 0 (delta 0)
Unpacking objects: 100% (69/69), done.
Run Code Online (Sandbox Code Playgroud)
小智 7
我尝试了所有这些建议。这最终对我有用:
git clone https://gitlab.com/USERNAME/REPO.git
(用您的唯一信息替换 USERNAME 和 REPO)。