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 git@gitlab.com command
Right now I want to punch my computer. If you have any insight about how to resolve my issue, it would be greatly appreciated.
if you are in linux or macox , just try this in terminal:
if it return nothing, try this:
it must create identity in ~/.ssh/id_rsa
after retry :
it must return your identity, so after retry to clone , it's must work
NB: don't forget to add your ssh key in your profile gitlab
thanks
I found this after searching alot. It will work perfectly fine for me.
ssh-keygen
.ssh
folder.id_rsa.pub
. Open it on notepad. Copy all text from it.Now give it a shot and it will work for sure.
make sure you are not running
sudo git clone git@gitlab.com:project/somethiing.git
, otherwise ssh will look in/root/.ssh
instead of the key you uploaded~/.ssh/id_rsa
I added my
~/.ssh/id_rsa.pub
to the list of known SSH Keys in my GitLab settings https://gitlab.com/profile/keys. That solved the problem for me. :-)