Github SSH issue 'Permission Denied' - github

I am stuck on this annoying (and common) issue running Manjaro (latest). SSH works just fine for me on my local network. I can connect to my file server and pi-hole just fine.
GitHub however is proving more difficult.
gh repo clone User/Reponame gives the following:
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
Cloning into 'Reponame'...
warning: templates not found /usr/share/git-core/templates
The authenticity of host 'github.com (140.82.121.3)' can't be established.
RSA key fingerprint is SHA256:SomeLongNumberBlahBlah.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/USER/.ssh/known_hosts).
Load key "/home/USER/.ssh/id_rsa": Permission denied
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.
exit status 128
Now I tried deleting my known_hosts, checking the file permission, creating new keys for my server/pi-hole and all works fine. I don't see why GH is struggling with permission. I've tried a few solutions but nothing seems to work for me. I've set my global user and email for github, I just can't get passed this step.
ssh -T git#github.com Asked for a passphrase and accepted it when I entered. Yay! I have both keys set and added to github.com via my browser etc. I must be missing something.
Still no change in the clone command. I am honestly stuck having read multiple threads on the subject. SSH always gets me :(

Related

Setting up an SSH Key and

I am new to coding and have been tasked with setting up a new SSH Key and connecting to GitHub. I have followed all the steps, and when I check if I have successfully paired I get this message:
$ ssh -T git#github.com
The authenticity of host 'github.com (140.82.121.4)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi indiataylor1! You've successfully authenticated, but GitHub does not provide shell access.
Can anyone point me in the right direction ?
Have tried creating a new SSH Key and starting from scratch.
You are good to go.
The "ED25519 key fingerprint" message is seen only at the first SSH connection, and yours does match the official GitHub ones.
If you try again ssh -T git#github.com, you will only see:
Hi indiataylor1!
You've successfully authenticated, but GitHub does not provide shell access.
From there, start cloning your repository with:
git clone git#github.com:You/yourRepository

Github SSH is connected but fails when cloning a repository into Digital ocean droplet

I'm setting up a laravel website with a Digital Ocean droplet.
This process is so difficult and frustrating, I'm losing logic sense...
I'm connected with an ssh key that is connected with github, because I tried this code to test my connection:
ssh -T git#github.com
with this as response:
> Hi (My name)! You've successfully authenticated, but GitHub does not
> provide shell access.
So it is connected.
However, when I want to clone my repository into my online droplet. I get the error:
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.
So I have no idea how to fix this..
My ssh key inside my digital ocean settings is the same as in my github ssh settings.
Any ideas how to fix this?
I've found the solution myself!
So what was the problem?
I was using the ssh key from my localhost as an access key for cloning private github repositories. That is why I couldn't clone into an online service because that online service has it's own specific ssh key. So inside my server, I generated an ssh-key and registered that one on github. When I tried cloning me repo inside my droplet
everything worked as it should do.

GitHub ssh keys - ssh test works but using git clone returns permission denied

I've been working on this for a few hours now and I've read everywhere but am officially stumped.
I'm trying to set up ssh keys for a dev-environment to interact with github. I've followed the guide on github and have made the keys and when I test them using the git#github.com it works but when I use git clone git#github.com:username/repo I get
Cloning into 'reponame'...
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.
I've tried adding it to ssh-add and that works, ssh-agent is running and has access. I've looked at the environment variable and set it to ssh among a few other things. I don't know what else to try. Let me know what logs I can post to help.
My thoughts are maybe the git command isn't using the identities or the right ssh client but other than the environment variables I'm not sure what else to change.
Thanks for the help in advance.

AWS-CPP-SDK download from git fails

I'd like to install the c++ sdk on my ec2 instance. The bash command to do this is given on this page: https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup.html
"To build the SDK from source"
...
"Clone with Git: git clone git#github.com:aws/aws-sdk-cpp.git"
I downloaded git on my instance and tried this command and get these errors:
"The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists."
If I can't resolve this, then I need to do a direct download. Can I do a Direct download via curl? I'd like to be able to get a fresh download every time I launch a new instance so that I pick up all the new code updates.
The given download(checkout)instruction is based on the assumption that you are using ssh to access Github. You should set up ssh key on Github to make that work.
Otherwise, you can use Https to check it out: git clone https://github.com/aws/aws-sdk-cpp.git

Permission denied to new ssh user when pushing

I'm using terminal, I want to delete ssh keys from and old user (old_username) and set a new one (new_username). I have done as is in this tutorial.
When I run: ssh -T git#github.com I get the correct message:
`Hi new_username! You've successfully authenticated'.
But when I try to push a repository I get denied:
remote: Permission to new_username/test2.git denied to old_username.
fatal: unable to access 'https://github.com/new_username/test2/': The requested URL returned error: 403
I've tried deleting .ssh folder and setting again ssh, but the problem persists.
Using an https url means your ssh connection is not used. At all.
Try switching to ssh:
git clone git#github.com:new_username/test2
That will actually use your ssh credentials, meaning your public and private keys stored in ~/.shh/id_rsa(.pub).
If on Linux or OSX, check a file called ~/.netrc, which contains username/password information that most apps will use when connecting to remote servers. Yes, it even affects git via the https protocol. If you're using a frontend to connect to github, you probably need to clear its preferences so it stops trying to use the old username.