Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub: Permission denied (publickey). fatal: Could not read from remote repository

I´m having trouble with GitHub. I´ve playing around with a remote repository of Git.

When I now try to make any changes to the remote directory, i.e.

git remote show origin 

or

git push -u origin master 

I get this error

Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. Ulrichs-MacBook-Pro:coredatatest ulrichheinelt$ git push -u origin master Permission denied (publickey). fatal: Could not read from remote repository.

I would be happy, when I could start again with a new (empty) remote directory. Or is there a way, to fix this error?

This are my first steps with GitHub, started yesterday... Many thanks in advance!

Edit 1

my settings at https://github.com/UlliH/CoreDataTest/settings

...

Edit 2

too early happy :-(

After setting the SSH and GPG keys, the errors are still the same. :-/

Edit 3

I think that's right so, but still the same...

enter image description here

like image 712
Ulli H Avatar asked Jul 24 '16 19:07

Ulli H


People also ask

How do I fix Git GitHub Permission denied Publickey fatal could not read from remote repository?

The “Permission denied (publickey). fatal: Could not read from remote repository” error is caused by an issue with the way in which you authenticate with a Git repository. To solve this error, make sure your key is being used on your Git account. If it is not, add your key to Git.

How do I fix Permission denied in GitHub?

Always use the "git" user$ ssh -T [email protected] > Permission denied (publickey). If your connection failed and you're using a remote URL with your GitHub username, you can change the remote URL to use the "git" user. You should verify your connection by typing: $ ssh -T [email protected] > Hi username!

How do I fix SSH permission denied Publickey?

Solution 1: Enable Password Authentication If you want to use a password to access the SSH server, a solution for fixing the Permission denied error is to enable password login in the sshd_config file. In the file, find the PasswordAuthentication line and make sure it ends with yes .


1 Answers

  1. Generate SSH key using ssh-keygen -t rsa -b 4096 -C "your email".
  2. Copy the output of cat ~/.ssh/id_rsa.pub to your clipboard
  3. Paste the above-copied output to the form at https://github.com/settings/ssh/new

Update: If you are still facing "ssh: connect to host github.com port 22: Connection timed out", then follow the below steps.

Check the connection, mostly it will time out

$ ssh -T [email protected] ssh: connect to host github.com port 22: Connection timed out 

Check the same by providing optional param port

$ ssh -T -p 443 [email protected] Hi <user_name>! You've successfully authenticated, but GitHub does not provide shell access. 

Update the SSH settings

$ vim ~/.ssh/config # Add github in the know hosts Host github.com   Hostname ssh.github.com   Port 443 

Check the connection, mostly it will connect this time

$ ssh -T [email protected] Hi <user_name>! You've successfully authenticated, but GitHub does not provide shell access. 
like image 124
Shravan40 Avatar answered Sep 24 '22 13:09

Shravan40