I’m having a lot of trouble uploading to GitLab from my Mac. My boss believes he has given me the necessary permissions, it’s a matter of SSH keys. Here’s what I’ve done:
- Freshly upload my SSH key (of the ssh-ed25519 variety) to GitLab. What shows in my profile matches what shows from
tr -d '\n' < ~/.ssh/id_ed25519.pub
- Add the following to my .ssh/config:
Host gitlab.com
IdentityFile ~/.ssh/id_ed25519
- Test:
`% ssh git@gitlab.com`
PTY allocation request failed on channel 0
Welcome to GitLab, @Joymaker2!
Connection to gitlab.com closed.
% ssh Joymaker2@gitlab.com
Joymaker2@gitlab.com: Permission denied (publickey).
I don’t know if the latter result was an expected result or a bad result. Is there something I’m missing here?
Hi Joymaker,
Firstly, .ssh/config
matters about identation → so make sure IdentityFile is indented (1 tab) under Host.
Secondly, you’re testing it wrong xD You’re trying to ssh into the server itself, which of course doesn’t work.
From docs, proper test would be:
ssh -T git@gitlab.com
You don’t need to put your username, you’re authenticated by your keys.
If this works, your setup is correct.
So, all you need to do now is clone your project by using SSH link, which would look something like this:
git clone git@gitlab.com:path/to/my/project.git
1 Like
As @paula.kokic said, you use git@gitlab.com
to connect over SSH - the key knows that it relates to your login in Gitlab. As I’ve quoted from your text above, the first test worked, since you correctly connected with git@gitlab.com - however your subsequent attempt with user: joymaker2 will not work and this is correct response for that.