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 [email protected]:root/test.git
I am getting this error:
Initialized empty Git repository in /server/user/[email protected]: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.
If you want to clone it to a specific folder, just insert the folder address at the end like so: git clone https://<token>@github.com/<username>/<repository.git> <folder> , where <folder> is, you guessed it, the folder to clone it to! You can of course use . , .. , ~ , etc.
It looks like there's not a straightforward solution for HTTPS-based cloning regarding GitLab. Therefore if you want a SSH-based cloning, you should take account these three forthcoming steps:
Create properly an SSH key using your email used to sign up. I would use the default filename to key for Windows. Don't forget to introduce a password! (tip: you can skip this step if you already have one ssh key here)
$ ssh-keygen -t rsa -C "[email protected]" -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.
Copy and paste all content from the recently id_rsa.pub
generated into Setting>SSH keys>Key from your GitLab profile.
# Copy to clipboard pbcopy < ~/.ssh/id_rsa.pub
Get locally connected:
$ ssh -i $PWD/.ssh/id_rsa [email protected] 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.
Finally, clone any private or internal GitLab repository!
$ 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.
You have your ssh clone
statement wrong: git clone username [email protected]:root/test.git
That statement would try to clone a repository named username
into the location relative to your current path, [email protected]:root/test.git
.
You want to leave out username
:
git clone [email protected]:root/test.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With