0

I tried to push to remote repository to gitlab, I got error message like below.

git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I already share public key to gitlab and I made a repository to push.

I think it might indicate that I have problem ssh connection. However, I've done ssh connection configuration correctly.

Actually, I did connection test(ssh -T gitlab) then I got successful message

Welcome to GitLab, @MYUSERNAME!

And I write config in ~/.ssh/config like

Host gitlab 
     Hostname gitlab.com
     User git
     IdentityFile ~/.ssh/conf.d/personal/id_ed25519_gitlab
                                                             

I read official document about ssh connection.

And I tried to remake my key and reflect that config to gitlab. It seems to work when connection testing, but not to work when pushing to remote repository.

I cannot handle this problem at all, please help about this.

Nine
  • 1
  • What is the ownership / permissions on the remote repo? Does `eval $(ssh-agent); ssh-add ~/.ssh/conf.d/personal/id_ed25519_gitlab` change anything? – Brian61354270 Aug 20 '23 at 13:39
  • @Brian61354270 It seems to change nothing... Sorry I'm not understand well yet about git. Please teach me what ownership / permissions on the remote repo is. I followed the guide below and stacked in setting remote repo. https://about.gitlab.com/blog/2022/10/24/publishing-an-astro-site-with-pages/ – Nine Aug 20 '23 at 14:00
  • Please run `git remote -v` and show us the result. – ChrisGPT was on strike Aug 20 '23 at 16:02
  • What if you modify your `~/.ssh/config` file and put `Host gitlab.com` instead of `Host gitlab`? – Grobu Aug 20 '23 at 18:58
  • Does this answer your question? [Git: How to solve Permission denied (publickey) error when using Git?](https://stackoverflow.com/questions/2643502/git-how-to-solve-permission-denied-publickey-error-when-using-git) – Arty-chan Sep 02 '23 at 17:38

0 Answers0