Obviously, the project set up was new to me as well. I never used VS Code before, neither GitLab or Heroku, so I didn't know some of the basic rules at the beginning. I took notes but even with the notes under my nose, I couldn't figure out how am I supposed to connect to GitLab using my SSH key when my laptop died last week.
I figured it out, in the end!
....but I had to connect information from two or three articles.
I think that if I put it all together here, it will be easier for someone else that encounters the same issue or, hell, it would be easier for me too to remember these things.
This is how I managed to create a SSH key and connect to my GitLab account using that key:
1) Open Git Bash (Download and Install Git Bash; You can use any
*nix based command prompt).
This will take you to the root directory for Git (Likely C:\Users[YOUR-USER-NAME].ssh\ on Windows).
3) In the
.ssh folder you should find these two files:
id_rsa.pub. These files tell the computer how to communicate with GitHub, BitBucket, or any other Git based service.
Those files were obviously missing from my computer so I had to create them.
Once you entered that command, you will get a few more questions:
Then this will be shown:
In the end, the entire process looks like this:
Enter file in which to save the key (/home/demo/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/demo/.ssh/id_rsa. Your public key has been saved in /home/demo/.ssh/id_rsa.pub. The key fingerprint is: 4a:dd:0a:c6:35:4e:3f:ed:27:38:8c:74:44:4d:93:67 demo@a The key's randomart image is: +--[ RSA 2048]----+ | .oo. | | . o.E | | + . o | | . = = . | | = S = . | | o + = + | | . o + o . | | . o | | | +-----------------+
The public key is now located in /home/demo/.ssh/id_rsa.pub. The private key (identification) is now located in /home/demo/.ssh/id_rsa.
4) Copying the public key to GitLab
Go and open the
id_rsa.pub file (you can use any text editor you want).
Copy the entire content of that file and then open
Paste the content you copied from
id_rsa.pub in the Key input (don't add extra spaces or characters).
Give your key a descriptive name and then Add the key.
5) Try to
git clone or
I really hope this will help someone because this article is what I needed last week when I couldn't put things together and all seemed to be way harder than it actually is.