I know this is a replica of the question Git push permission denied (publickey) but successfully authenticated
But the real issue is not solved.
I have been using https connection for the past year on my prod Linux server and as you all know git removed the HTTPS ability to pull and push. Now it is all done though the SSH.
So i went through github guide how to set up the ssh. Generating ssh keys with "ssh-keygen -t ed25519 -C "your_email@example.com"" Adding it to the ssh agent and all of that done correctly 100 times checked through.
So this is what I have:
ssh-add -l
or
ssh-add -l -E sha256
returns me this:
256 SHA256 BLAH BLAH BLAH (which is matching to my github account key)
another command
ssh -vT git@github.com
returns big list (dont think there is a need to show it all) of the commands ran through but as the outcome it connects and returns my username:
debug1: Reading configuration data /home/[userName]/.ssh/config
debug1: /home/[userName]/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [140.82.121.4] port 22.
debug1: Connection established.
debug1: identity file /home/[userName]/.ssh/id_ed25519 type 3
debug1: key_load_public: No such file or directory
debug1: identity file /home/[userName]/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version babeld-d410d4f8
debug1: no match: babeld-d410d4f8
debug1: Authenticating to github.com:22 as 'git'
...........
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([140.82.121.4]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = ru_RU.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi GitHubUserName! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2012, received 2388 bytes, in 0.2 seconds
Bytes per second: sent 8477.3, received 10061.5
debug1: Exit status 1
another one:
ssh -T git@github.com
return this:
Hi GitHubUserName! You've successfully authenticated, but GitHub does not provide shell access.
I know many of you going to think i might use HTTPS remote url but no. It is ssh remote. And also to another question that was asked to this replica question: My project is existed one, and on my prod server i have only been pulling for the past year. So the project is existing in my repo, I only need to pull. With existing branch too (JUST TO MAKE SURE IF SOMEONE tries to say something FUNNY :D )
git remote -v
returns:
origin git@github.com:[myUserName]/[myRepo].git (fetch)
origin git@github.com:[myUserName]/[myRepo].git (push)
another one to make sure i have the .ssh/config file which previously i didnt have it. But also tried to create it and set it up just incase it will fix my issue (but it didnt resolve the permission issue) so the content of the config file is:
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/id_ed25519
TCPKeepAlive yes
IdentitiesOnly yes
The ssh/id_ed25519 is the default ssh generation name by the Github SSH guide. Only thin I have added the Passphrase. I was thinking that the issue is in the Passphrase, but i was wrong. After i deleted the keys and created ssh key again with the default settings without Passphrase gave me the same result. In fact when I had Passphrase set, and running the pull command it never asked me for the Passphrase to be entered, it was throwing the Permission connection error straight away, which i found very strange on this part.
So when I run command
sudo git pull
even if I try to do it with origin and branch name still the same result:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Please guys help me out. I am stacked on this for over 5 hours already. Tried every single stackoverflow & github suggestion. No idea why it doesnt work for prod web server.
On my local I use only ssh git connection and it is working like a clock. The same setups.
At some point I think maybe it is some admin linux restrictions or something like it. But not sure.
Please suggest me something. In advance, big thanks for your help!