0
  1. I already made a repository in github as wordpress-template.
  2. I created a .git repository locally, added some files there, and committed it.
  3. Then I created a remote as origin and give it the url of the github repository as:

    git remote add origin git@github.com:squalporeover/wordpress-template.git  
    
  4. Now I want to push my master branch to that repository. I ran the following command:

    git push origin master 
    
  5. But it shows:

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

    Please make sure you have the correct access rights and the repository exists.

Michael
  • 8,362
  • 6
  • 61
  • 88
squal
  • 185
  • 3
  • 14
  • 5
    Possible duplicate of [Git - Permission denied (publickey)](https://stackoverflow.com/questions/2643502/git-permission-denied-publickey) – Francesco Aug 22 '17 at 19:09
  • It seems to be duplicate but those kind of answer not solve my problem – squal Aug 22 '17 at 21:43

3 Answers3

0

You need to use ssh-keygen to generate an ssh key pair. See: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

Duplicate found here: Git - Permission denied (publickey)

0

It looks like you added the SSH version of the remote URL. In order to use this you need to set-up Github with SSH.

Otherwise use the HTTPS version of the clone URL which will ask for your username and password: enter image description here

logix
  • 622
  • 5
  • 18
0

This worked for me:

Step 1- git remote rm origin

Step 2-select the http option in github

step 3- run the following command again

git remote add origin https://github.com/yourdirectory/link.git

git branch -M main

git push -u origin main