0

I create my GitHub repository, and then I run this command using Git base:

  1. git init

  2. git add -A

  3. git commit -m 'my commit'

  4. git remote add origin git@github.com:myprofile/my-new-project.git

  5. git push -u -f origin master

But after running the last command, my project did not push in Git.

It gave me an error:

git push -u -f origin master

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.

How can I push my project and why do I get this error?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BiswajitPaloi
  • 586
  • 4
  • 16
  • 2
    "permission denied" means what it says. Use `ssh -Tv git@github.com` to diagnose why your ssh can't connect to GitHub, or if it can, who GitHub consequently believe you are; then log in to GitHub and see what access you, as whoever they believe you are, has, to that repository. – torek Dec 29 '21 at 14:45
  • https://stackoverflow.com/search?q=%5Bgit%5D+Permission+denied+publickey – phd Dec 29 '21 at 14:47
  • Note that this has very little to do with Git. Git doesn't know anything about authentication. You are basically asking how to use GitHub. But then just read GitHub's instructions. – matt Dec 30 '21 at 14:41

0 Answers0