Data Science Explorer

How to fix the Error git@github.com: Permission denied (publickey). 본문

GitHub

How to fix the Error git@github.com: Permission denied (publickey).

grace21110 2023. 11. 1. 21:29
반응형

Today, I was trying to conduct 'git push' but I saw the error, saying 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.

 

Luckily, I found my way out to solve this out! The reason was that ssh key that was linked to Github was not set. The steps are quite easy so, please follow the step. 

 

Step 1. Go to the environment where you want to conduct 'git push'.

 

Step 2. Open the Git Bash. 

 

Step 3. Write the code 

ssh-keygen -t rsa -C “Your email address for your Git hub account”

 

Step 4. It will ask you where you want to locate the key. If you just press "Enter", it will be placed on (~/.ssh/id_rsa.pub) default location. 

 

Step 5. For the next step, it will ask you if you want to make a password. If you don't want to, you can press "Enter". 

 

Step 6. Then you will finally get the key on ~/.ssh/id_rsa.pub. You should not reveal this key to anyone otherwise, others would be able to use your Github!

 

Step 7. Since you have to register your key on your Github, write cat ~/.ssh/id_rsa.pub and copy your key. 

 

Step 8. Go to your Github, Settings -> SSH and GPG Keys.

 

Step 9. Click "New SSH key" and insert the key that you copied from the terminal. 

Now you are all set! You will be able to conduct git push or git pull!

 

 

'GitHub' 카테고리의 다른 글

How To Upload A Folder On GitHub: A Step-by-Step Guide  (0) 2023.08.05
GitHub Command Words That You Must Know  (0) 2023.08.02
GitHub vs. Git  (0) 2023.08.01