Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[email protected]: Permission denied (publickey)

Tags:

I created a new remote repository and tried to use git push -u origin master command to push my local files into the new repository the first time after I add it and commit it. However, it pops up this [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.. How can I fix this fatal error?

I've tried this
How to solve Permission denied (publickey) error when using Git? It seems that the question in this link happens in the first time using git. I've used my git for a while, do I still need to follow this solution? Can anyone gives me a more specific solution?

This the fatal error that I got

C:\Users\ASUS\Desktop\React-Practice App\my-app>git status On branch master nothing to commit, working tree clean  C:\Users\ASUS\Desktop\React-Practice App\my-app>git push -u origin master [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. 
like image 540
Jessie Avatar asked Aug 31 '19 01:08

Jessie


People also ask

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 git permission denied public key?

In terminal enter this command with your ssh file name pbcopy < ~/. ssh/id_rsa. pub This will copy the file to your clipboard Now open you github account Go to Settings > SSH and GPG keys > New SSH key Enter title and paste the key from clipboard and save it. Voila you're done.

What does git GitHub Permission denied Publickey mean?

Feb 15, 2021 · 10 min read · SSL · [email protected]: Permission denied (public key).fatal: Could not read from remote repository. - It means GitHub is rejecting your connection because - It is your private repo. GitHub does not trust your computer because it does not have the public key of your computer.


1 Answers

You’re accessing GitHub through SSH. First generate an SSH key pair; then add the public key to GitHub.

Generate key pair, github prefers the "Ed25519 algorithm"

ssh-keygen -t ed25519 -C "[email protected]" 

It still allows using rsa for systems that don't support Ed25519

ssh-keygen -t rsa -b 4096 -C “[email protected]

See more at https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account

like image 133
Moazzem Hossen Avatar answered Sep 22 '22 13:09

Moazzem Hossen