1

This error comes up a lot, but the usual method has not fixed this issue: GIT push: permission denied (public key) .

This fix has not helped me. I was able to do:

ssh -T [email protected]

... with no issue at all.

git remote -v

... also returns the correct URL with SSH pattern.

This is the third time I've tried to link to a GitHub page, so I'm not sure why I'm getting this issue only now. Is there any chance that I'm being denied access by the host of the github page? Could it somehow be a fault on their end?

I am able to pull from this branch and merge, but when I tried to push my merge conflicts, as well as some updates to the code I now receive the error (after entering the passphrase for my ssh key):

Enter passphrase for key '~/.ssh/id_rsa':
ERROR: Permission to <path>.git denied to <UserName>.
fatal: Could not read from remote repository.

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

Maybe my username is wrong? I tried setting it to my github name as well as the name returned that I am being denied as.

Thanks for any help in advance!

FlamePrinz
  • 490
  • 1
  • 5
  • 20

1 Answers1

1

I think you simply don't have access to write to this repository.

For example:

$ git clone [email protected]:freeCodeCamp/freeCodeCamp.git
Cloning into 'freeCodeCamp'...
remote: Enumerating objects: 113, done.
remote: Counting objects: 100% (113/113), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 96160 (delta 46), reused 81 (delta 36), pack-reused 96047
Receiving objects: 100% (96160/96160), 63.21 MiB | 1.58 MiB/s, done.
Resolving deltas: 100% (57205/57205), done.
Checking connectivity... done.

$ cd freeCodeCamp

$ git checkout -b push-test
Switched to a new branch 'push-test'

$ touch push-test

$ git add push-test 

$ git commit -m push-test
[push-test 0916790] push-test
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 push-test

$ git push origin push-test 
ERROR: Permission to freeCodeCamp/freeCodeCamp.git denied to msbit.
fatal: Could not read from remote repository.

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

As @tim-biegeleisen notes, you'll have to talk to the repository owner (possibly yourself?) and get them to allow access to your user. This will be the one mentioned in the output of ssh -T [email protected].

msbit
  • 4,152
  • 2
  • 9
  • 22