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 de
I use ubuntu 18.04, and it was actually permission issue in my local machine. The issue was gone when I set read/write permission to my .git folder.
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
How to add SSH key to gitlab account in ubuntu?
SSH key will appear. Copy those and
Go to your gitlab account.
SSH-Key will be added!
(N.B if you have Generate Previews SSH Key and Getting permission denied (public key). You Delete Your Previews ssh key and Generate new one and add git user.name and email on your terminal )
There is a very simple solution to this: instead of working with ssh - move to https. to do this: in your project folder you have a .git folder in there - you have a config file - open it in a text editor and change the line
url =git@gitlab.com:yourname/yourproject.git
to
url = https://gitlab.com/yourname/yourproject.git
Steps to be done, got same error but i fixed it. Gitlab wants ssh-rsa so below is the code to run ssh for rsa
ssh-keygen -o -t rsa -b 4096 -C "name@gmail.com"
name@gmail.com is your gitlab account email
It will prompt you to enter so just hit Enter after the below code is prompt,
Enter file in which to save the key (/home/yourDesktopName/.ssh/id_rsa):
It will prompt again you to enter so just hit Enter after the below code is prompt,
Enter passphrase (empty for no passphrase):
It will prompt again for the last you to enter so just hit Enter after the below code is prompt,
Enter same passphrase again:
You will show your ssh-rsa generate.
Login to your Gitlab account and Go to the right navbar you will get setting and in the left sidebar you will get ssh key. Enter in it.
Look above the prompt asking you to enter, you will get the path of ssh-rsa.
Go to your SSH folder and get the id_rsa.pub
Open it and get the key and Copy Paste to the Gitlab and you are nearly to done.
Check by: ssh -T git@gitlab.com
You will get: Welcome to GitLab, @joy4!
Done.
When you have multiple git account and you want different ssh key
You have to follow same step for generating the ssh key, but be sure you
ssh-keygen -t ed25519 -C "your-email-id@gmail.com"
Enter the path you want to save(Ex: my-pc/Desktop/.ssh/ed25519)
Add the public key to your gitlab (How to adding ssh key to gitlab)
You have to new ssh identity using the below comand
ssh-add ~/my-pc/Desktop/.ssh/ed25519