Issue
My problem is that I can't push or fetch from GitLab. However, I can clone (via HTTP or via SSH). I get this error when I try to push :
Permission denied (publickey) fatal : Could not read from remote repository
From all the threads I've looked, here is what I have done :
- Set up an SSH key on my computer and added the public key to GitLab
- Done the config --global for username and email
- Cloned via SSH and via HTTP to check if it would resolve the issue
- Done the ssh -T [email protected] command
If you have any insight about how to resolve my issue, it would be greatly appreciated.
Solution
I found this after searching a lot. It will work perfectly fine for me.
- Go to "Git Bash" just like cmd. Right click and "Run as Administrator".
- Type
ssh-keygen
- Press enter.
- It will ask you to save the key to the specific directory.
- Press enter. It will prompt you to type password or enter without password.
- The public key will be created to the specific directory.
- Now go to the directory and open
.ssh
folder. - You'll see a file
id_rsa.pub
. Open it on notepad. Copy all text from it. - Go to https://gitlab.com/-/profile/keys or
- Paste here in the "key" textfield.
- Now click on the "Title" below. It will automatically get filled.
- Then click "Add key".
Now give it a shot and it will work for sure.
Answered By - Muhammad Laraib Khan