- I already made a repository in github as wordpress-template.
- I created a .git repository locally, added some files there, and committed it.
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
Now I want to push my master branch to that repository. I ran the following command:
git push origin master
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.
Asked
Active
Viewed 6,771 times
0
-
5Possible 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 Answers
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)

Robert Hartshorn
- 176
- 10
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:

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