How to solve [email protected]: Permission denied (Public key) problem?

44k Views Asked by At

I was working with git to commit my files and folder to new repository. Everyone time when I was pushing my code it asked for username and password (which is github token for me). To avoid this I read solution on Configuring user and password with Git Bash given by @manojlds.

So I ran this command: git remote set-url origin git+ssh://[email protected]/username/reponame.git after reading it.

Now when I am pushing my code it neither the problem is solved nor it is giving me option to enter username and password(token)

After doing $ git push it is showing this

[email protected]: Permission denied (publickey). fatal: Could not read from remote repository.

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

What should I do to revert it back and so that at least I can enter username and password(token) and upload my files and folder.

1

There are 1 best solutions below

0
On BEST ANSWER

From August 13, 2021, no longer accepts Password-based authentication. Github provides a more secure alternative to it and ie. PATs(Personal Access Tokens).

How to generate personal access token

If you have done this properly, You can also refer this

GitHub Error Message - Permission denied (publickey)