Created
March 28, 2020 20:19
-
-
Save imshaiknasir/7172a9b241aa9101f7a9fd8e21399c01 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Below mentioned solution is for ["Windows Users"] only. Others can visit here: https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent | |
1. Open Git Bash. | |
2. Type cd ~/.ssh. This will take you to the root directory for Git. { C:\Users\[YOUR-USER-NAME]\.ssh\ } | |
3. Now hit the below command: | |
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com" | |
4. If it asks for anything, hit ENTER | |
> Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter] | |
> Enter passphrase (empty for no passphrase): [Press enter] | |
> Enter same passphrase again: [Press enter] | |
5. Ensure the ssh-agent is running: | |
$ eval $(ssh-agent -s) | |
> Agent pid 59566 [Output sample] | |
6. Add your SSH private key to the ssh-agent: | |
$ ssh-add ~/.ssh/id_rsa | |
7. Now, copy the SSH key to your clipboard: | |
$ clip < ~/.ssh/id_rsa.pub | |
8. Open your Github account in browser and follow this navigation: | |
Click on Profile icon > Settings > In the user settings sidebar, click "SSH and GPG key" > Click New SSH key or Add SSH key > Paste your key into the "Key" field. > Click Add SSH key. | |
# Now, git push, it should work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Key is invalid. You must supply a key in OpenSSH public key format